Commit Graph

7552 Commits

Author SHA1 Message Date
jean-pierre charras 3692c511d0 Zone fill: display progress bar when refilling a zone after edition.
Previously, refilling a zone after edition was made silently,
thus creating not understandable but very noticeable freeze time for complex zones.
2019-03-14 10:18:50 +01:00
jean-pierre charras 23086deccd Pcbnew fix: chamfered corners settings not copied with copy/paste pad properties
Fixes: lp:1819595
https://bugs.launchpad.net/kicad/+bug/1819595
2019-03-12 11:28:07 +01:00
Seth Hillbrand 6006703798 pcbnew: Remove fills prior to updates
Removing existing fills will prevent re-drawing invalid polygons before
they are ready.  This seems to happen on Macs more easily due to redraw
timing.

Fixes: lp:1819553
* https://bugs.launchpad.net/kicad/+bug/1819553
2019-03-11 16:25:43 -07:00
jean-pierre charras 80cf4ec5cb Add comments about SVG import. 2019-03-11 19:25:52 +01:00
jean-pierre charras 61567d3917 Pcbnew: Enable SVG import in DIALOG_IMPORT_GFX. 2019-03-11 18:30:59 +01:00
jean-pierre charras d259459a14 Pcbnew: add a new primitive pad shape: chamfered round rect pad.
Allows 0 to 4 chamfered corners, not only one.

A custom shape allow this kind of shape. However because it is a primitive,
it is easier to edit and it support thermal reliefs.
2019-03-11 10:26:15 +01:00
jean-pierre charras b9944e2c06 Thermal reliefs: fix a corner case that wrongly removes a stub in a thermal shape.
This was due to the stub removal tests if a stub end is outside a solid area to remove it.
There is a corner case: is the stub end is exactly on a solid area outline extra segment
created by Fracture() used in calculations.

The stub removal tests are now made before fracturing.

Fixes: lp:1819317
https://bugs.launchpad.net/kicad/+bug/1819317
2019-03-10 19:14:53 +01:00
John Beard 26d04269ac Pcbnew: disable module numbering in pcbnew arrays
The module refdes always increment by one. This is problematic
for two reasons:

* It doesn't work when more than one FP is selected (say you have
  C1 and C2, you get C1, C2, C2, C3)
* It messes with simple panellisations

The 5.0.x behaviour is to not renumber in Pcbnew, so revert to
that behaviour.

Better refdes incrementation can come post 5.1, as this will need
new strings and UI.

Fixes: lp:1819106
* https://bugs.launchpad.net/kicad/+bug/1819106
2019-03-08 10:34:43 +00:00
John Beard b6916c490c Pcbnew: allow tab traversal of footprint orientation text control
Disable the text update event for the orientation cutom value field before
updating it when the radio buttons are selected. This allows to use the
conventional EVT_TEXT handler, rather than KEYDOWN, which has two effects:

* Tabbing though the dialog no longer sets custom orientation
* Click-driven clipboard actions trigger the update correctly.

Introduce a helper function in validators.h to assist in updating
validated fields without triggering further events.

Fixes: lp:1819006
* https://bugs.launchpad.net/kicad/+bug/1819006
2019-03-07 20:27:04 +00:00
John Beard 4574349539 UI: Automatic wxFB changes in pcbnew edit footprint dialog
Commit automatic changes to keep diffs clean when real changes are made.
2019-03-07 20:27:04 +00:00
jean-pierre charras 5eee88b78a Pcbnew, Draw zones in GAL mode: fix missing initialization of line color.
It is noticeable only in printing mode.

Fixes: lp:1818971
https://bugs.launchpad.net/kicad/+bug/1818971
2019-03-07 21:09:03 +01:00
jean-pierre charras 26acd39129 Fix a few Coverity warnings. 2019-03-07 20:01:47 +01:00
Seth Hillbrand 523b37d9ae pcbenw: Clear contours before regenerating in DRC
When checking for closed outlines, we generate a board area using the
pcb structure.  We now also check for overlapping outlines due to
lp:1818163 However, the DRC maintained its previous outline before
generating the new one, causing an overlap error.

This regenerates the board outline from zero for each DRC run.

Fixes: lp:1819012
* https://bugs.launchpad.net/kicad/+bug/1819012
2019-03-07 09:45:54 -08:00
Seth Hillbrand 5ba2a08366 pcbnew: Set filename in Page Layout template
pcbnew refreshes the viewItem for the worksheet multiple times.  This
requires setting the filename to get parameters displayed on the
worksheet correctly.

Fixes: lp:1819000
* https://bugs.launchpad.net/kicad/+bug/1819000
2019-03-07 06:01:53 -08:00
jean-pierre charras 200ff1cda6 Pcbnew: Fix incorrect polygonal shape of thermal reliefs of rect pads.
Depending on thermal reliefs size, the polygons could be self intersecting,
and these self intersecting polygons are unexpected in zone calculations.
Other fix: the width of thermal stubs is clamped to the size of pads.
Previously, a bug in clamping calculations prevents constraining thermal stubs width.

Fixes: lp:1818752
https://bugs.launchpad.net/kicad/+bug/1818752
2019-03-07 14:31:12 +01:00
Wayne Stambaugh 4612175da2 Pcbnew: better fix for dialog default button handler issues.
Use DIALOG_SHIM::SetInitialFocus() to fix default button handler issue
on all platforms.  Commit cabc33b4 only fixed the problem on windows.
2019-03-04 15:30:32 -05:00
Seth Hillbrand 3dfa57fe1d pcbnew: Clear highlight cross-probe
When highlighting a new net, clear the Eeschema highlight before
selecting items

Fixes: lp:1815147
* https://bugs.launchpad.net/kicad/+bug/1815147
2019-03-04 12:00:59 -08:00
Tomasz Włostowski 92e2aa31a9 pcbnew: router: fix non-45 degree tail merge in LINE_PLACER
Fixes: lp:1817795
* https://bugs.launchpad.net/kicad/+bug/1817795
2019-03-04 18:33:10 +01:00
Wayne Stambaugh cabc33b4cd Pcbnew: fix dialog default button handler issues.
Set the focus to some control in the copper zone, non-copper zone, and
keep out zone dialogs required for the default button action to work
properly.  This only seem to affect windows dialogs.

Fixes lp:1818397

https://bugs.launchpad.net/kicad/+bug/1818397
2019-03-04 11:34:04 -05:00
Jeff Young cedef13bb1 Enable default OK button.
Fixes: lp:1818397
* https://bugs.launchpad.net/kicad/+bug/1818397
2019-03-04 12:06:40 +00:00
Jeff Young 69f003ba4a Remove previous cell selection fixes in favour of slow-click hack.
wxWidgets has several bugs that result in cell editors being closed
right after they're opened.  There are two wxWidgets hacks to
partially address this: the SetInSetFocus() hack, and a slow-click
hack.  We used to try and work-around these bugs ourselves for
single-click access, but this changelist moves those over to
wxWidget's slow-click hack.

Fixes: lp:1817965
* https://bugs.launchpad.net/kicad/+bug/1817965
2019-03-04 11:09:33 +00:00
jean-pierre charras 643d884fde Pcbnew: fix issue in legacy canvas when dragging a footprint (connectivity not updated)
Fixes: lp:1818388
https://bugs.launchpad.net/kicad/+bug/1818388
2019-03-03 19:11:25 +01:00
Wayne Stambaugh 8d26b07f67 Fix potential string iterator issue.
Added checks to StrCmpNum() function in common/sting.cpp to prevent
iterating past the end of the sting.  Also removed length of string
parameter since it did not seem to be used anywhere.

Fixes lp:1818157

https://bugs.launchpad.net/kicad/+bug/1818157
2019-03-02 08:20:53 -05:00
Seth Hillbrand 40309a17ef pcbnew: Check exact overlapping polygons
Checks for polygon collisions in the outline when the polygon contains
two or more segments that exactly overlap.  This also places the DRC
marker at the location where the collision happens.

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

Fixes: lp:1818218
* https://bugs.launchpad.net/kicad/+bug/1818218
2019-03-01 09:38:33 -08:00
jean-pierre charras 1ba1c6dbf3 DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE: fix minor wxWidgets alerts. 2019-02-28 18:56:48 +01:00
jean-pierre charras a391e5a236 Add comments 2019-02-28 13:35:37 +01:00
Jeff Young e25970592c Tighten up spacing a bit for 1024x768 monitors.
Fixes: lp:1817974
* https://bugs.launchpad.net/kicad/+bug/1817974
2019-02-28 11:36:09 +00:00
jean-pierre charras 16cbd25ed2 DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE: fix a minor wxWidgets alert. 2019-02-28 09:14:11 +01:00
jean-pierre charras 2768b3ddbe Pcbnew: fix check zone fills before plotting doesn't test no net zones.
Fixes: lp:1817797
https://bugs.launchpad.net/kicad/+bug/1817797
2019-02-27 11:27:18 +01:00
Jeff Young 73f0b3087c Initialize grid visibility correctly when opening project files. 2019-02-26 18:24:07 +00:00
jean-pierre charras 4d08906288 Pcbnew: fix 2 minor issues
* fp editor: ensure axis are drawn after switching the backend
* DIALOG_PNS_SETTINGS: ensure violate DRC option is correctly enabled/disable when opening the dialog.
2019-02-25 11:34:32 +01:00
Seth Hillbrand 1be759c5c1 pcbnew: Force rotation to grid
When setting the modification point of a group, we get the grid-snapped
coordinate

Fixes: lp:1674835
* https://bugs.launchpad.net/kicad/+bug/1674835
2019-02-23 14:48:12 -08:00
Seth Hillbrand d36fbba1f3 pcbnew: Violate DRC only enabled in Highlight mode
Violating the DRC cannot happen in shove or walk around mode as we use
the DRC to calculate these actions.  The tooltip explains this as well
but we need to explicitly disable the checkbox to prevent users from
thinking that they can complete DRC violating tracks in other modes.
2019-02-23 08:19:50 -08:00
Seth Hillbrand f47089a804 pcbnew: Enforce router settings
When the user selects "Ignore DRC" in the Highlight collisions mode,
they should be allowed to start drc violating tracks as well as end
them.
2019-02-23 08:19:50 -08:00
John Beard 82734e7116 Adjust tab ordering in some dialogs
Introduce a shortcut method to set tab ordering and use it in
the dialogs that override the tab traversal orders:

* Eeschema sheet properties
* Pcbnew Move exact
* Pcbnew Move relative

Also set some initial focus fields in the same dialogs.

Tidy a few includes.

Fixes: lp:1816009
* https://bugs.launchpad.net/kicad/+bug/1816009
2019-02-23 14:49:38 +00:00
John Beard 498a566ca3 Pcbnew: fix spacing in move exact dialog
The middle text ctrl has borders on both top and bottom, should be just
one for even spacing.
2019-02-23 14:49:38 +00:00
jean-pierre charras 0421335ac1 Minor fix in DIALOG_PAD_PROPERTIES: set show grid to false. 2019-02-23 12:31:00 +01:00
Jeff Young f14cf5cbc7 More uniform handling of state saving in global edit dialogs.
Includes Edit Text and Graphics Properties and Edit Track and Via
Properties.  It's also no longer board-specific as it turns out the
board timestamp is always 0 anyway.
2019-02-21 15:11:16 -07:00
Seth Hillbrand dae7b03465 gal: re-enable arc outline mode
Fixes: lp:1816373
* https://bugs.launchpad.net/kicad/+bug/1816373
2019-02-21 10:52:54 -08:00
jean-pierre charras 9ff0868813 pcbnew: fix incorrect sizing of net list display in DIALOG_SELECT_NET_FROM_LIST 2019-02-19 20:07:38 +01:00
Seth Hillbrand b426b9e784 pcbnew: Re-add missing user units python
When moving user user units out of the global, we missed that Python
calls were using it.  This re-adds a function to retrieve user units
allowing the python scripts to show users dialogs in their preferred
units.
2019-02-19 10:52:39 -08:00
Wayne Stambaugh de625e81cb Fix footprint editor library tree filter text control issue.
The default hot key definition for toggle high contrast mode was 'H'.
On windows, the menu accelerator handler code was grabbing the character
so it would not appear in the filter text control.  This is expected
because the windows wxWidgets code hooks this at the application level
so that once a menu accelerator key is found, all further event handling
for that key stops.  Changing the hot key definition to 'Ctrl+H' resolves
the issue.

Fixes lp:1803556

https://bugs.launchpad.net/kicad/+bug/1803556
2019-02-19 12:52:38 -05:00
Seth Hillbrand 4597979d18 cairo: Draw ovals with filled half-arcs
The circle at the end only ever looked right with 100% opacity.

Also fixes double-drawn arc fills in Cairo
2019-02-18 16:09:44 -08:00
Seth Hillbrand 525b9bd550 pcbnew: Correctly set the radio buttons in fpeditor
Radio buttons always have one set, so we need a single path to setting
the correct button.
2019-02-18 15:16:00 -08:00
jean-pierre charras 2dd653a327 WX_GRID: revert GetVisibleWidth() and add EnsureColLabelsVisible() to fix column label height of our wxGrid, for multiline column labels 2019-02-18 20:34:44 +01:00
jean-pierre charras e798cbe6c7 Fix a minor wxWidgets assert in DIALOG_SELECT_NET_FROM_LIST_BASE. 2019-02-18 11:33:53 +01:00
jean-pierre charras d62163cc7c Netclass panel: fix incorrect column sizes, that happens in a few languages.
The best size was calculated from a default size.
This default size (calculated by wxWidgets) was fully broken with some texts in a few languages.
So now this best size does not use this default size.

Fixes: lp:1816315
https://bugs.launchpad.net/kicad/+bug/1816315
2019-02-18 10:09:22 +01:00
Seth Hillbrand 27b4f2fbe9 pcbnew: Fix incorrect Type settings
Fixes: lp:1816259
* https://bugs.launchpad.net/kicad/+bug/1816259
2019-02-17 07:46:47 -08:00
Jeff Young dc5ae574e2 Restore ability to hide grid columns.
wxGrids stupidly does this by setting the width to zero, so you
have to be careful when adjusting minimum widths.
2019-02-17 14:09:35 +00:00
Jeff Young 076f07c683 Be more forgiving of large fonts in grids. 2019-02-17 10:38:06 +00:00
Jeff Young d751fecd8a Tooltip and error message improvements. 2019-02-17 10:20:29 +00:00
Jeff Young f1fb61202a Spelling fixes. 2019-02-17 10:18:42 +00:00
Jeff Young f5369c9d2c Clean up some extraneous TEXT_CRTL_EVAL references.
(UnitBinder gives you evaluation for "free".)
2019-02-17 10:16:09 +00:00
Tomasz Włostowski bbee30671a gal: pixel alignment hacks, works for Retina display too now.
gal: pixel alignment for Cairo.
gal: pixel alignment for OpenGL

Cleanup of pixel alignment patches

gal/opengl: more pixel alignment patches:
- works on Retina displays now
- pixel alignment for circles
- correct 1-pixel strokes
- fixed unfinished 1-pixel line ends

GAL: Restore antialiasing options in Cairo
GAL: Fix arc drawing

Removes DrawArcSegment, which drew arcs whose edge was optionally
stroked (a feature that we did not use).  Fixes Cairo arc drawing issue
where arcs were not visible in pcbnew.

gal: further cleanup
gal: removed unused shader parameter
2019-02-16 20:03:13 +01:00
jean-pierre charras 303b7ac7f8 Pcbnew: fix delete dangling tracks only removes the last segment of tracks.
Fixes: lp:1816234
https://bugs.launchpad.net/kicad/+bug/1816234
2019-02-16 16:05:29 +01:00
jean-pierre charras ec59361f75 Fix a few coverity errors 2019-02-16 14:09:21 +01:00
Seth Hillbrand 79f990266b drc: Allow graphical items to connect pads
This permits footprints like solder jumpers and net-ties.  (originally
from 3439551543 from Jeff Young)
2019-02-15 11:22:55 -08:00
jean-pierre charras c8d44b86e2 Fix a compil issue with some compilers. 2019-02-15 08:47:03 +01:00
Seth Hillbrand 5e5167f198 pcbnew: Adjust footprint properties columns
Size based on text width in 3d and check for overflow before expanding
the first column.
2019-02-14 22:09:01 -08:00
Seth Hillbrand 8b46c99c60 modedit: Fix footprint properties dialog
Checks for text in the dialog before setting width.  Also prevents
resizing beyond the width of the window (in the case of large fonts)
2019-02-14 22:02:34 -08:00
Seth Hillbrand a02f447daa pcbnew: Do not auto edit the 3d-model grid
Auto-selecting of the first grid element is performed in the footprint
editor to facility rapid editing.  Rapid editing of the 3d-model fields
is not as useful and requires multiple esc-keys to cancel.  This limits
the auto-edit to only the reference tab.

Fixes: lp:1815456
* https://bugs.launchpad.net/kicad/+bug/1815456
2019-02-14 16:29:51 -08:00
Seth Hillbrand 1f7022cb64 pcbnew: Do not source highlight from non-copper pads
Highlight connections is meant to show the copper connections on a
board.  We remove the non-copper pads from our selection when attempting
to source the net for highlighting.

Fixes: lp:1815898
* https://bugs.launchpad.net/kicad/+bug/1815898
2019-02-14 15:20:49 -08:00
Seth Hillbrand 2c61b7d7d6 pcbnew: Prevent invalid values from loading
Items that are located at the edge of or outside of integer limits will
not be shown on screen as they don't fit in the VIEW RTree.  This
prevents them from being edited and can corrupt data output.  Instead,
we place them at the largest value that is representable on the RTree
(INT_MAX/SQRT(2)).  This allows the user to correctly utilize DRC as
well as interact with and remove the offending items.

Fixes: lp:1815642
* https://bugs.launchpad.net/kicad/+bug/1815642
2019-02-14 14:28:42 -08:00
jean-pierre charras e6a200b09e Pcbnew: avoid integer overflow when displaying local coordinates.
Minor cleanup in code.
2019-02-14 10:57:22 +01:00
Seth Hillbrand 2cbbcfd3e0 Doxyfiles: Remove local debug lines 2019-02-13 17:22:07 -08:00
Seth Hillbrand 5c855a097b Doxygen: Update doxyfiles
Adds/updates commentary and removes empty, obsolete DTD tags
2019-02-13 10:18:07 -08:00
jean-pierre charras b6027e0815 Drill dialog: fix incorrect parent window when called from the Plot dialog.
The parent window was always the board edit frame,
but this is incorrect when this dialog is called from the Plot dialog.

Fixes: lp:1815530
https://bugs.launchpad.net/kicad/+bug/1815530
2019-02-13 11:41:52 +01:00
Seth Hillbrand 3524bed75a libtree: Remember pane width
Stores the library pane width in settings to keep user preferences
2019-02-12 10:06:36 -08:00
Seth Hillbrand 7b3ef1b7ed colors: Add HSL conversion and tune colors
When adding colors to length tuner, we depend on the window background
color, which can be set by the user, resulting in an unreadable text.
This uses the HSL conversion to detect which shade it should use for the
coloring.

Also adds test cases for round-trip HSL and HSV conversion

Fixes: lp:1814530
* https://bugs.launchpad.net/kicad/+bug/1814530
2019-02-11 22:08:41 -08:00
Wayne Stambaugh fe5d2b8710 Pcbnew: fix footprint properties dialog 3D model visibility issue.
Update 3D model panel on initial dialog load to reflect the current
visibility state of the 3D model.

Fix a few minor footprint properties dialog spacing issues.

Fixes lp:1815184

https://bugs.launchpad.net/kicad/+bug/1815184
2019-02-10 12:00:19 -05:00
jean-pierre charras a703c53312 Fixes in dialogs: mainly better sizes for grid columns, but more other minor fixes.
Fix wxGrid column minimal widths on Windows in dialogs (just fixing the size is not enough).
WX_GRID::GetVisibleWidth(): make width bigger for labels, because they usually use a bold font.
(However, the fix is just a workaround: a better code is welcome)
2019-02-10 16:40:47 +01:00
jean-pierre charras 5e318dc08a Pcbnew, PANEL_PCBNEW_ACTION_PLUGINS: make strings translatable.
Fix also a minimal size for grid columns.
2019-02-10 11:39:07 +01:00
jean-pierre charras 8dc4077d58 Fix compatibility issues with wxWidgets 3.1.1 2019-02-10 07:59:27 +01:00
Seth Hillbrand 8ff764376a wx_grid: abstract visible column width
Cleanup code for checking visible extents of grid text.  Places single
routine to extract the current spacing from the grid in WX_GRID.
2019-02-09 15:31:31 -08:00
jean-pierre charras 1c8077148a Pcbnew: legacy plugin: avoid crash when reading malformed files (old .brd kicad files).
Fixes: lp:1815292
https://bugs.launchpad.net/kicad/+bug/1815292
2019-02-09 18:12:42 +01:00
jean-pierre charras c0a86d734d Pcbnew, Excellon drill file creation: for oval holes allows selection of an alternate command, when the normal command is not accepted.
Using the normal command, oval holes are "drilled" by a route command.
Some board houses do not accept this normal command.
In this case, the drill dialog allows using an other Excellon drill command (a slotted hole).
Note also some board houses do not understand this alternate command!
2019-02-09 14:56:02 +01:00
jean-pierre charras 756b20ace8 Fix column minimal sizes in panel_setup_text_and_graphics.cpp on Windows. 2019-02-09 14:47:45 +01:00
jean-pierre charras 61a95c5440 Fix compatibility with wxWidgets 3.1.1 2019-02-09 11:21:09 +01:00
Seth Hillbrand 76600e3436 pcbnew: Force grid sizing based on text extents
GTK does not handle enlarged text layouts automatically, so we need to
get the screen size before choosing the correct grid width for the
dialog

Fixes: lp:1788495
* https://bugs.launchpad.net/kicad/+bug/1788495
2019-02-08 20:03:45 -08:00
Jeff Young 076499f3ad Set modify flag for immediate block commands.
Fixes: lp:1812124
* https://bugs.launchpad.net/kicad/+bug/1812124
2019-02-08 19:15:16 +00:00
Seth Hillbrand c0008bc757 pcbnew: Change track width should allow no changes
When doing a global edit of the tracks and vias, we need to allow for
the possibility that the track size doesn't change and that this is
explicitly allowed without DRC error.
2019-02-08 10:49:00 -08:00
Seth Hillbrand e1bce7dccd pcbnew: Prevent using "edit width" in dialogs
Editing predefined tracks/nets/vias sizes makes sense in the toolbar but
not inside the submenu.
2019-02-08 09:50:20 -08:00
John Beard edc73de023 Pcbnew: ignore start values in "first available" grid numbering
The using the "first available" numbering option, force an
artifical linear numbering scheme starting at '1'.

Start the pad name provider at the 0'th pad index.

Also adds a few related tests and adjusts tests affected by
this change to reflect that the offset still applies.

This can be expanded in future to be more general by skipping
pad (which would allow a custom start and numbering scheme
while still avoiding duplication), but for now,
this does what the UI says and avoids string changes in 5.1rc.

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

Fixes: lp:1814917
* https://bugs.launchpad.net/kicad/+bug/1814917
2019-02-08 12:15:02 +00:00
John Beard 0c6ec7dbb3 LIB_TABLE_BASE: Const and unsigned fixes
* Make LIB_TABLE_BASE::GetCount() return unsigned. This is more
  consistent with the behaviour of STL containers (especially the
  boost::ptr_vector this is really accessing). Sadly
  wxGridTableBase() forces an int, so a cast is still required
  at the WX interface.
* Make LIB_TABLE_BASE::At() return a reference. First, this is more
  consistent with normal STL indexing operator[]'s, and secondly, it
  allows an idiomatic const index method (so you can access const
  LIB_TABLE_ROWs from a const LIB_TABLE_BASE).

The motivation is to allow use of this class and LIB_TABLE_ROW
in a test program, where the LIB_TABLE_BASE is const.
2019-02-05 08:49:52 -08:00
John Beard e6a6266f3d Build: libpolygon provides its own includes
Libpolygon can provide its own includes via target_include_dirs PUBLIC.
This means any linking targets do not need to specifiy them manually.

As common requires polygon, the polygon dep is also now no longer
required downstream of libcommon, as it's transisitvely implied
by libcommon's target_link_libraries.

This resolves a circular dependency previously detected and also
simplifies CMakeLists.
2019-02-04 19:29:31 -08:00
John Beard bb2ae8e13b Bitmaps: move bitmap defs to bitmaps library
The bitmap definitions (BITMAP_DEF and so on) do not
have any dependencies on other libs, including WX. This
means the bitmaps library can be isolated from the other
dependencies.

Common now depends on bitmaps, and libraries that depend
on common can pick it up from the common target_link_libraries,
as it is PUBLIC. This means a lot of targets no longer
need manual bitmap linkage.

This avoids a circular dependency that was previously reported
by static analysis.

Avoiding pulling in WX and other headers into the include
tree of each bitmap .cpp is a huge speed up (around 10x) in
compilation, and the generated static library is also 10x
smaller (20MB vs 200MB)

Add common as a link library to pnsrouter,connectivity.
THese library do still use common code (including bitmaps,
via base_screen.h) and this allows them to pick up the libcommon
includes correctly.
2019-02-04 19:29:31 -08:00
jean-pierre charras 73a0cbff62 pcbnew, export to STEP: fix error in command line tolerance option (--min-distance="0.0100 mm") is some countries
In countries using a comma as floating point separator, the --min-distance="0.0100 mm" was passed as --min-distance="0,0100 mm"
This is incorrect and broke the command line.

Fixes: lp:1814559
https://bugs.launchpad.net/kicad/+bug/1814559
2019-02-04 18:05:49 +01:00
Seth Hillbrand d7272b7f5e eagle: Handle DRC rule-based pad shapes
Circles and Squares are handled correctly.  Octagons are converted to
circles.  Pad 1 is identified by the "1" string in the Eagle name.

Fixes: lp:1784126
* https://bugs.launchpad.net/kicad/+bug/1784126
2019-02-04 07:06:49 +01:00
Seth Hillbrand 1d09f84303 router: Take track width in dp from dp
Fixes and issue where forces were calculated using the current track
width even in differential placer mode where the tracks are specified by
the differential pair width.

Fixes: lp:1814480
* https://bugs.launchpad.net/kicad/+bug/1814480
2019-02-04 03:48:08 +01:00
Tomasz Włostowski 5d712716e6 router: don't create incorrect non-45 degree connections when routing a track that doesn't have a net assigned
Fixes: lp:1814433
* https://bugs.launchpad.net/kicad/+bug/1814433
2019-02-03 12:37:27 +01:00
Seth Hillbrand 08c944a467 cairo: Ensure Courtyard drawing order
Prevent courtyard from being raised twice

Fixes: lp:1811821
* https://bugs.launchpad.net/kicad/+bug/1811821
2019-02-03 11:27:31 +01:00
Seth Hillbrand a8e920bdef std-ize layer lists
Cleanup of list work to use std models.
2019-02-03 11:27:31 +01:00
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 c08736e245 Assign stack pointer to lib table
When creating new lib table rows, the pointer becomes managed by the new
table through the boost::ptr_vector.  The row is non-copyable, however,
so we lose the reference as soon as it goes out of scope. Creating a
clone provides a new pointer that is moved into the table on creation.

Fixes: lp:1792456
* https://bugs.launchpad.net/kicad/+bug/1792456
2019-02-03 05:20:50 +01:00
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 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
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
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 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 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 2dea3a49c8 Fix compile error in std::pow useage. 2019-01-30 16:38:34 +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
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
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
jean-pierre charras a4d4d9a241 Fix not working sdip_wizard.py 2019-01-29 08:42:28 +01: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
Jeff Young 577bb73320 Revert 7d06651a10. 2019-01-28 20:10:13 +00: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 fd0381ea09 router: fix dragging when dragged segment has adjacent segment(s) at 180 degree angle
Fixes: lp:1812535
* https://bugs.launchpad.net/kicad/+bug/1812535
2019-01-28 10:31:50 +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
Thomas Pointhuber 4fc692f04b fix handling of filled circle and default layer width 2019-01-26 07:42: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 184711beb4 pcbnew: Fix via snapping to multiple tracks
Rather than selecting an arbitrary track to snap, we select the closest
track to our point, allowing the via to be placed along the full track
length.

Fixes: lp:1813324
* https://bugs.launchpad.net/kicad/+bug/1813324
2019-01-25 09:13:18 -08:00
Seth Hillbrand ff9d814fbd Fix unused vars in wxpython3 2019-01-24 21:25:39 -08:00
John Beard d39cdb5565 Pcbnew: Disallow invalid mwwave inductor lengths
Some microwave inductor lengths cause invalid outputs
for the calculations, which causes jagged outputs.

* If the request length is such that four arcs and no straight
  segments is too long
* If the length is such that an N-turn coil is too short, but
  an N+1-turn coil is too long. This can happen when the coil
  count is small.

This patch doesn't fix the underlying geometric issue here - fixing
the first requires a numerical method, and fixing the second probably
needs an iterative approach. Both of these could benefit from
a refactor.

However, this patch does prevent the tools producing invalid outputs,
which can sometimes be quite subtle mistakes if the "jags" are small.

Fixes: lp:1792119
* https://bugs.launchpad.net/kicad/+bug/1792119
2019-01-24 21:23:43 -08:00
Seth Hillbrand 8b060799eb python: Fix Phoenix app setting
Phoenix doesn't have the same initialization as wxpython3 and so the
namespace doesn't get the wxApp() initialized to the existing instance.
In python, this is worked around by starting a new wxApp.
Unfortunately, this appears to overwrite the existing global instance
variable.  The issue _appears_ to be in Phoenix but for now we work
around it by saving and resetting the instance pointer in the main app.
The downside is that Python likely won't be able to respond to events
from C++

Fixes: lp:1809913
* https://bugs.launchpad.net/kicad/+bug/1809913
2019-01-24 19:41:07 -08:00
jean-pierre charras 70c2380fc2 Minor fixes in code: remove dead code. 2019-01-24 18:23:57 +01:00
John Beard b1a2c5d7c5 Zones: wxPoint/VECTOR2I warnings no longer needed
In the past, the ZONE_CONTAINER::GetPosition() member
returned a reference to a wxPoint, in accordance with the
BOARD_ITEM interface. This meant that ZONE_CONTAINER had
to reinterpret_cast a VECTOR2I (its internal position data) to wxPoint,
which was possible only due to fortunate memory layout.

This interface was changed to return wxPoints by value in
commit a4528988ca, and the normal (wxPoint) cast was used instead.

Thus, we can now also remove the dire warnings and static_asserts
used to ensure the now-unused old method was correct.
2019-01-23 10:39:03 -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
John Beard e6edc1b670 DRC: Make the marker factory a separate class
This separates the "newMarker" functions from the DRC class. These
are moved to a new class, DRC_MARKER_FACTORY, which is now responsible for
constructing suitable markers from BOARD_ITEMS.

The reasons for this are:

1) Allow DRC related functions to access theese functions without having
   to bake these functions into the main DRC class.
2) Thereby simplify the DRC class interface
3) As DRC_MARKER is now a small class with public interfaces, it's
   possible to put unit tests on these functions.

The motivation here is to allow to start to split out pieces of DRC
into separate classes.
2019-01-23 13:27:52 -05:00
Seth Hillbrand 4247e32cd6 pcbnew: Disallow new via where DRC is violated
Prior to placing the via, we check if the resulting via will pass too
close to different nets on different layers.

Fixes: lp:1718827
* https://bugs.launchpad.net/kicad/+bug/1718827
2019-01-23 10:20:59 -08:00
jean-pierre charras 86263d6bb3 Pcbnew: Do not immediately refresh the 3D view after each board edition.
Previously, when the 3D viewer is opened, each board edition creates a 3D view refresh, that usually takes a bit of time.
Now the refresh is postponed until the 3D viewer has the focus.
2019-01-23 17:47:17 +01: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
jean-pierre charras 56879a964b Fix cross-probing issue when a net or pin name contains a space.
Fixes: lp:1812902
https://bugs.launchpad.net/kicad/+bug/1812902
2019-01-23 11:30:10 +01:00
Seth Hillbrand 6421b15b83 pcbnew: Allow an epsilon in the inflate before join
Plotting mask layers, we expand by a minimum width before performing a
boolean add of the separate regions.  The boolean add has a separation
condition that includes equality.  Since we are looking for the
complement of the mask, we would like the equality applied to the other
side.  Removing a unit value provides the separation.

Fixes: lp:1698457
* https://bugs.launchpad.net/kicad/+bug/1698457
2019-01-22 19:54:03 -08:00
Seth Hillbrand 0c723778f0 pcbnew: Set default missing soldermask min width
When loading an existing file, a missing value in the soldermask min
width value should not be interpreted as a default value but rather as a
0 value.  This corrects an issue introduced by 4d709d2392
2019-01-22 17:01:32 -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 b0ab53ac26 Dxf importer: fix some issues, especially the rotation angle of texts. 2019-01-22 19:59:43 +01:00
jean-pierre charras c56d6ad2dd Fix issues in DXF import and GFX import dialog
Fixes: lp:1812840
https://bugs.launchpad.net/kicad/+bug/1812840
2019-01-22 18:01:04 +01:00
Seth Hillbrand 7551613826 pcbnew: Don't duplicate TOOL_EVENT
There is some odd interaction in the default copy constructor for
TOOL_EVENT using boost::optional under gcc.  Avoid this by explicitly
constructing the event needed for cut

Fixes: lp:1812848
* https://bugs.launchpad.net/kicad/+bug/1812848
2019-01-22 08:36:56 -08:00
jean-pierre charras a1d1354bcc footprint_editor_tools.cpp: Better code in Placepad. 2019-01-21 21:33:37 +01:00
jean-pierre charras 4d88cd3a0a Footprint editor: add missing local coordinate initialization in Add Pad. 2019-01-21 21:03:36 +01:00
Wayne Stambaugh b13efdb0f2 Initial global footprint library table fixes.
Fix bug when pcbnew is launched from a folder containing an existing
fp-lib-table file by using same method as setting the initial global
symbol library table.

Fixes lp:1810169

https://bugs.launchpad.net/kicad/+bug/1810169

Fixes lp:1738871

https://bugs.launchpad.net/kicad/+bug/1738871
2019-01-20 13:51:07 -05:00
jean-pierre charras 179dfa0dda Pcbnew fix missing initialization in PCB_PAINTER::draw( const TRACK* aTrack, int aLayer )
the stroke mode was always activated, even in fill mode. creating incorrect size shape for null length track segments.

Fixes: lp:1812532
https://bugs.launchpad.net/kicad/+bug/1812532
2019-01-20 10:12:21 +01:00
Seth Hillbrand 4443487f04 pcbnew: Check GetBoard() before using
GetBoard() may return nullptr in the case of a pad that does not belong
yet to the board.
2019-01-19 19:32:50 -08:00
jean-pierre charras 9cac0a38cc DIALOG_GRAPHIC_ITEM_PROPERTIES: better tooltip.
minor other code enhancement (does not create any actual change)
2019-01-19 12:35:35 +01:00
jean-pierre charras 3667b11682 fp editor: very minor fix: fix incorrect icon in toolbar 2019-01-19 07:54:02 +01:00
jean-pierre charras e2afe5e1a3 Toolbars with wxComboboxes: Fix incorrect ReCreate Toolbar methods: they recreated these wxComboboxes without deleting the previously created.
This issue created memory leak and not working wxComboboxes (for instance after modifying the language selection).
Now, these wxComboboxes are created only once, never recreated.

Also: minor cosmetic enhancement in footprint editor main toolbar
(the save footprint icon is modified if the footprint is saved to the board or to the library)
2019-01-18 17:24:40 +01:00
Seth Hillbrand 4cf4600a23 pcbnew: Discard delete action when routing
Prevent the action from being handled on the next transition.

Fixes: lp:1810611
* https://bugs.launchpad.net/kicad/+bug/1810611
2019-01-17 19:38:01 -08:00
Seth Hillbrand 5182fe15d3 Minor code formatting 2019-01-17 19:17:34 -08:00