Commit Graph

4485 Commits

Author SHA1 Message Date
Jon Evans ec39bdda77 GerbView: fix saving of canvas type and lingering legacy menu item
Fixes: lp:1829647
* https://bugs.launchpad.net/kicad/+bug/1829647

(cherry picked from commit b00e20b23f)
2019-05-19 16:17:53 -04:00
Jeff Young 7d9a0b06e0 Push help menu down into EDA_BASE_FRAME. 2019-05-18 13:14:08 +01:00
Jeff Young 13aa503614 Hack for wxWidgets failure to open menu on MSW. 2019-05-18 00:21:49 +01:00
Jeff Young 1a3d0492f5 Push polar coords down into COMMON_TOOLS. 2019-05-18 00:21:49 +01:00
Jeff Young 48fb78418c Fix merge error. 2019-05-16 20:05:45 +01:00
Jeff Young b4d4525496 Fix icon-scaling issue for ACTION_TOOLBAR.
Fixes: lp:1829291
* https://bugs.launchpad.net/kicad/+bug/1829291
2019-05-16 19:57:06 +01:00
Jeff Young fbb807f3bb Move some more menu & toolbar items to modern toolset. 2019-05-16 19:57:06 +01:00
Seth Hillbrand ddc6079ceb Move remaining hard-coded segment counts
This removes the remaining hard-coded segments counts and replaces them
with the relative error calculation where the segments per arc is
determined by the maximum error we allow (smaller arcs = fewer segments)
2019-05-16 08:49:55 -07:00
John Beard 8378f97a78 Eeschema: enable grid change hotkey
Add the N/Shift+N hotkeys to the eeschema hotkey file.

Also adjust the COMMON_TOOLS::GridNext/Prev to work when
the screen's grid definitions do not have consecutive command
IDs (they do not in eeschema).

This is related to lp:1811018 (but doesn't constitute a fix).
* https://bugs.launchpad.net/kicad/+bug/1811018
2019-05-16 14:10:43 +01:00
John Beard 0eb8f92c69 Pcbnew: add a step field to the array tool
This is useful, for example, when arraying only one side
of a connector.

Fixes: lp:1809580
* https://bugs.launchpad.net/kicad/+bug/1809580
2019-05-16 11:20:52 +01:00
John Beard 2c1b970027 Arrays: isolate axis code in a new class
Remove the axis numbering code from ARRAY_OPTIONS
and place in a new class, ARRAY_AXIS. This keeps
the logic for the array item numbering separate from
the logic for the array item geometry.

This simplifies the logic in the ARRAY_OPTIONS class, which
no longer has to deal with the numbering of each axis.
2019-05-16 11:20:52 +01:00
Wayne Stambaugh f08d040c02 A better fix for commit d34433a1.
Replace INCREMENTAL_TEXT_CTRL with wxSpinCtrlDouble because it looks
and works better.

Remove INCREMENTAL_TEXT_CTRL header and source files because the only
place they were used was in GAL_OPTIONS_PANEL.
2019-05-15 18:18:01 -04:00
Seth Hillbrand 0eb391b13f plotter: We we trying to export mm but chose in
Note that the comment in line 142 where the scale factor was set had the
correct value to indicate metric (1) but in the actual boilerplate, we
set imperial (0).  This has been around for 6-8 years, so it would seem
DXF is not our most popular export.

Note, I initially tried to use '1' to specify metric units but this was
not handled by DXF readers (QCAM, Inkscape).  Instead, scaling the page
units to inches properly seems to work.
2019-05-15 14:54:25 -07:00
Seth Hillbrand a0f477cc5f Fix default button option on close
The default is meant to be "Save" but "Discard" was selected due to ID
ordering on creation.  Setting the focus before setting the default
makes the "Save" option the highlighted option that can be selected
immediately by pressing enter.
2019-05-15 12:14:20 -07:00
Wayne Stambaugh d34433a1df Fix GAL display options panel spin button layout on windows.
Fixes lp:1829224

https://bugs.launchpad.net/kicad/+bug/1829224
2019-05-15 14:59:14 -04:00
Jeff Young 69afa27a5f Implement ACTION_TOOLBAR and update some of the menus to ACTION_MENU.
This gives us better separation of MVC in line with the design of
the modern toolset.  It also reduces a whole bunch of duplicated
data.
2019-05-15 17:50:52 +01:00
Jeff Young f9e4ee1fc9 CONTEXT_MENU -> ACTION_MENU. (Now used for menu-bar menus too.) 2019-05-15 17:50:52 +01:00
Jeff Young 06d64c7883 Use wxMessageBox instead of ASSERT for duplicate hotkey warnings. 2019-05-15 17:50:52 +01:00
Jeff Young e850592587 Cleanup. 2019-05-15 17:50:52 +01:00
John Beard dcd4b13104 Remove workaround for fixed issue (spaces in text crash GAL)
The spaces-crash-GAL issue (lp:1668455) was fixed by
ef8f5db024.

THis removes a work-around in the arc drawing assistant.
2019-05-14 13:29:45 +01:00
John Beard 6cf7ad68ad Pcbnew: break out preview draw helpers
The graphical drawing routines in the arc assistant can be
made more generic for re-use in similar code.
2019-05-14 13:29:45 +01:00
John Beard 041c52c369 Arc preview: Add guide circle
When drawing an arc, show a guide circle that indicates the
radius of the arc at the current cursor. This can be useful
as a guide for seeing where the arc will reach once the radius
is fixed by the second click.

Fixes lp:1796158
* https://bugs.launchpad.net/kicad/+bug/1796158
2019-05-14 13:28:55 +01:00
Jeff Young ef5c69167a Start moving some LibEdit and SchEdit menubar menus to actions.
Also includes a bunch of bug fixes that got intermingled.

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

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

Fixes: lp:1828793
* https://bugs.launchpad.net/kicad/+bug/1828793
2019-05-13 21:44:29 +01:00
Wayne Stambaugh 3c4f8c1bf7 Fix frame name capitalization in all about dialogs.
This is a stop gap fix.  It should be possible to use the wxFrame title
string for this but some of the frame windows have appropriated the title
string for configuration file naming purposes which is less than ideal.

Fixes lp:1825977

https://bugs.launchpad.net/kicad/+bug/1825977
2019-05-13 15:40:44 -04:00
John Beard 18593d2dbb 3D viewer: decouple renderers from wxCursors
Provide a toolkit-agnostic interface for "busy indicators", which
allows the 3D viewer to show a busy cursor, without the canvases
having to to know how a wxCursore works.

The motivation here is to decouple the 3D renderers from the WX
GUI system, as they can then be used when when there is not an
active window (e.g. for offscreen rendering).

Otherwise, attempting to use a wxBusyCursor without a GUI
available is an instant segfault.
2019-05-12 14:19:39 +01:00
Jeff Young f8776f72ac Drop cell editor when selecting column.
Fixes: lp:1828222
* https://bugs.launchpad.net/kicad/+bug/1828222
2019-05-11 15:38:49 +01:00
Jeff Young 792c4328aa Cleanup. 2019-05-10 21:40:08 +01:00
Jeff Young e77d096412 Make setting a breakpoint easier. 2019-05-10 16:11:57 +01:00
Jeff Young ea0941cab3 Implement modern tools for LibEdit. 2019-05-10 16:11:57 +01:00
Wayne Stambaugh ae54f34392 Eeschema: fix corrupted schematic and symbol library files.
Prevent user from pasting text with carriage return and/or line feed
characters in field value edit control in the schematic symbol and symbol
library properties dialogs.

Make all objects derived from GRID_CELL_TEXT_BUTTON use validators
correctly.

Add validators to FIELDS_GRID_TABLE object for field values other than
the mandatory fields.

Create a validator to check that a string is a valid LIB_ID.

Fixes lp:1828214

https://bugs.launchpad.net/kicad/+bug/1828214
2019-05-10 08:21:37 -04:00
jean-pierre charras a155289f70 Custom pads: fix incorrect shape of masks when the shape is a polygon with holes and the mask margin is < 0.
This is mainly the solder paste layer that shows this issue.
This is due to the fact SHAPE_POLY_SET::Inflate does not work fine with polygons with linked holes.
SHAPE_POLY_SET::InflateWithLinkedHoles it added to fix this issue.

Fixes: lp:1828287
https://bugs.launchpad.net/kicad/+bug/1828287
2019-05-09 16:23:18 +02:00
Seth Hillbrand f7c042a357 pcbnew: Allow curves in custom pads
Updates custom pad functions to permit adding arbitrary curves to the
primitives
2019-05-08 15:54:26 -07:00
jean-pierre charras 533fdcf00a Cairo GAL: fix incorrect arc position in mirror mode.
the previous fix (2e43c6c64e) did not really work.
Add also comments to a few not yet documented methods.

Fixes: lp:1822772
https://bugs.launchpad.net/kicad/+bug/1822772
2019-05-08 14:24:26 +02:00
John Beard e6fe220f84 All: fix horizontal touchpad panning
Commit e10c01aaf didn't work when touchpad panning was enabled.

This commit changes it to only discard horizontal wheel events
when in "scroll mode" rather than "pan mode".

Based on a patch by Adrian Scripcă <benishor@gmail.com>.

Follow-up to fix: lp:1828080
https://bugs.launchpad.net/kicad/+bug/1828080
2019-05-08 11:06:44 +01:00
Adrian Scripca e10c01aaff All: fix spurious wheel scroll events caused when using modern mice.
Modern mice feature horizontal scrolling capabilities and those end
up being treated by KiCad as regular scroll events causing confusion
among users.

The fix works by discarding the handling of wheel events other than
the ones for the vertical axis.

Fixes: lp:1828080
https://bugs.launchpad.net/kicad/+bug/1828080
2019-05-07 17:34:51 +01:00
John Beard 4a3add7ac5 About dialog: Add mnemonics to the buttons 2019-05-07 10:27:33 +01:00
John Beard cc28fb18fd About dialog: update wxFB version
Avoid contaminating wxFB files with version fluff, which hides real
changes in the version history.
2019-05-07 10:27:33 +01:00
Jeff Young cd2bd23c37 Fix a bunch of issues with hotkeys, IDs and event processing.
Fixes: lp:1827894
* https://bugs.launchpad.net/kicad/+bug/1827894
2019-05-06 21:42:00 +01:00
Jeff Young 207900e4f9 Move libedit message panel updating to the Inspection Tool. 2019-05-06 15:31:23 +01:00
jean-pierre charras 2e43c6c64e Cairo GAL: fix incorrect arc position in mirror mode.
It happens in print mode and also when the Pcb view is flipped.

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

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

Fixes: lp:1823147
https://bugs.launchpad.net/kicad/+bug/1823147
2019-05-06 11:28:14 +02:00
Jeff Young a42a4b0b52 Implement immediate bus unfold and add bus unfold to selection context menu. 2019-05-05 17:14:30 +01:00
Jeff Young fd546da640 Homogenize hit testing and selection return types.
Prep work for sharing SCH_SELECTION_TOOL with LibEdit.
2019-05-05 17:14:30 +01:00
Jeff Young 9adf012c20 Move duplicate hotkey check so it respects AS_CONTEXT. 2019-05-05 17:14:30 +01:00
Jeff Young 6e695aac25 Move bus unfold and symbol unit selection to modern toolkit. 2019-05-05 17:14:30 +01:00
Jeff Young 423d430b58 Replace deleteNode and deleteConnection with selectNode and selectConnection. 2019-05-05 17:14:29 +01:00
Jeff Young 2244dcd567 Move show datasheet to SCH_INSPECTOR_TOOL and add show marker info. 2019-05-05 17:12:59 +01:00
Jeff Young 902be18a04 More modern toolset context menu work.
Text/label type changes and bus entry shape changes.  And some
context menu bug fixing.
2019-05-05 17:12:59 +01:00
Jeff Young b526461a8e Fix colliding hotkeys issue.
All grid commands need to be shared now as they're implemented
by a common tool.
2019-05-05 17:12:59 +01:00
Jeff Young 42383ae871 Build out some of the modern toolkit context menus. 2019-05-05 17:12:59 +01:00
Jeff Young 1c8461bec7 Transition mirroring to modern toolset. 2019-05-05 17:12:59 +01:00
Jeff Young f200c61897 Start transitioning block operations to modern toolset. 2019-05-05 17:12:59 +01:00
Ian McInerney 9e6e9d0910 Replace remaining Boost mutexs with std::mutex
CHANGED: Replaced all MUTEX types with std::mutex
         Replaced all MUTLOCK types with std::lock_guard
2019-05-03 17:13:20 -07:00
Jeff Young 2e8d930250 Fix merge issue.
Some legacy_gal code leaked into legacy_wx.

Fixes: lp:1827270
* https://bugs.launchpad.net/kicad/+bug/1827270
2019-05-03 00:11:38 +01:00
Wayne Stambaugh 7d803437e2 Eeschema: fix broken symbol library links.
Force the symbol library links whenever the symbol library table has been
modified.  This will use the cache as a fallback when a library has been
removed that contains links in the schematic rather than display.

Fix the SCH_COMPONENT symbol resolver when falling back to the cache.  The
resolver was using the LIB_ID ':' notation which was failing.  Replacing
':' with '_' fixed this issue.  This was also an issue when generating the
symbol message panel information.

Convert wxLogDebug to wxLogTrace in symbol resolver code path.  Add new
trace type KICAD_SYM_RESOLVE.

Fixes lp:1821606

https://bugs.launchpad.net/kicad/+bug/1821606
2019-04-30 13:05:27 -04:00
Jon Evans c054944d67 Set real-time connectivity to on by default with a safety valve 2019-04-29 18:59:32 -04:00
Jon Evans 49e88b267a Fix KICAD_RUN_FROM_BUILD_DIR on MacOS 2019-04-28 21:59:51 -05:00
John Beard 10900c918f Eeschema: Fix/circumvert GTK3 tree view bug
There is a rendering bug in GTK3, which appears to be
an upstream GTK issue.

This can be worked around by, when filtering, ensuring the
*parent* item of the selected item is visible. This will
not cause the selected item to not be visible, as the selected
item will be the first shown child. So it will be visible, as long
as the list box is greater than a single row high, which it will be
in all practical scenarios.

This is done on all platforms, as it has a beneficial side-effect:
the parent library of the selection is naturally shown to the
user, so they don't need to scroll up to see what library their
current filter selection was in.

Fixes: lp:1804400
* https://bugs.launchpad.net/kicad/+bug/1804400
2019-04-28 17:12:12 +01:00
John Beard fcc4a84e0e GAL: add some trace to GAL display options config
This can be helpful when tracing where certain configurations
come from (some apps load from other apps' config basenames).
2019-04-27 14:57:14 +01:00
John Beard d89d0e6b74 SHAPE_ARC: Fix bug introduced in 5813164d1.
This fixes the bug exposed in the previous commit.
The tests which exposed it now pass and expected failures
removed.
2019-04-25 23:49:42 +01:00
Tomasz Włostowski 5813164d15 SHAPE_ARC: fixed polyline conversion bug introduced in e312e2b286
Fixes: lp:1826278
* https://bugs.launchpad.net/kicad/+bug/1826278

Fixes: lp:1826270
* https://bugs.launchpad.net/kicad/+bug/1826270
2019-04-25 15:30:27 +02:00
Jon Evans 1426a4f3cf Ensure shown text is cached at creation 2019-04-25 00:46:51 -04:00
Jon Evans 3bfe5fb84b Cache unescaped text to boost connectivity performance 2019-04-25 00:14:25 -04:00
John Beard 15bba27406 BITMAP_BASE: Add const image data accessor
This allows a const BITMAP_BASE to expose const image
data. This is currently done with const_casts, which is
"OK", only as long as the source image is not declared
const, in which case it's undefined behaviour.

Also immediately dereference the pointer to a reference
if it's not checked to make the non-null requirements
explicit at the point of access.
2019-04-24 17:31:22 +01:00
John Beard e687d14903 Remove useless const_casts
Both versions of EDA_DRAW_FRAME::isBusy have a useless const_cast.

GetScreen() const returns a non-const SCH_SCREEN already, it doesn't
need to be cast, and it's stored in const SCH_SCREEN anyway.
2019-04-24 09:46:01 +01:00
Jeff Young 1a007c3e4b Implement SCH_SELECTION_TOOL (but still with legacy semantics). 2019-04-22 22:08:18 +01:00
Jeff Young a461eae8b9 Fix 100s of usages of GetFlags() which conflated != 0 with being edited.
While this was true long ago, many flags have been added since which
have nothing to do with editing (HIGHLIGHTED, BEGIN_ONPAD, etc.)
2019-04-22 09:58:06 +01:00
Jon Evans dffd1179c5 Add a mechanism to load kifaces when run from the build directory
This is useful when working on code paths that rely on KiWay
communications, since you can run and debug the kicad application
without needing to run an install task first.
2019-04-20 15:08:34 -04:00
John Beard 6ad97e5b5b Kicad Curl: Ignore unused functions for OpenSSL >= 1.1.0
In OpenSSL 1.1.0 and newer, the locking callback macros do nothing.
This causes unused warnings for the static function lock_callback.

Ignore this function on newer OpenSSL builds, but keep
the infrastructure for now.

When OpenSSL's min version is 1.1 or greater, all the locking
infrastructure can be removed.
2019-04-18 16:24:29 +01:00
Jeff Young 0772b54845 Move eeschema zoom-selection to modern toolset.
Fixes: lp:1825164
* https://bugs.launchpad.net/kicad/+bug/1825164
2019-04-17 21:49:50 +01:00
John Beard e312e2b286 SHAPE_ARC: fix polyline conversion when radius=0
Prevent a divide-by-zero bug in SHAPE_ARC::ConvertToPolyline.

When the radius is zero, just use the initial angle (it makes
no different anyway, the result is the centre point, which is
the start point.
2019-04-17 10:52:56 +01:00
jean-pierre charras 4d3e86d795 DIALOG_CONFIGURE_PATHS: do not allow users to define the env var KIPRJMOD
It always defines the project path, and should never be defined by users.

Fixes: lp:1824912
https://bugs.launchpad.net/kicad/+bug/1824912
2019-04-16 11:41:30 +02:00
jean-pierre charras ad5a1fd963 SIM_PLOT_FRAME: cosmetic enhancement: add icons in main menu.
Fix also Upeer/lower case issues in main menu strings.
2019-04-14 15:31:46 +02:00
Jeff Young 91bf08df1a Move ZoomFitScreen from GetBoundingBox to GetDocumentExtents. 2019-04-14 01:44:47 +01:00
Jeff Young 67bdf61682 Fix extra include. 2019-04-13 20:20:02 +01:00
Jeff Young 94a948fdd1 Move grid selection for both Eeschema and Pcbnew to COMMON_TOOLS. 2019-04-13 18:43:35 +01:00
Jeff Young fc7f5630c7 Move eeschema zoom operations to modern toolset. 2019-04-13 18:43:26 +01:00
Jon Evans dec5d80180 Veto mouse warping from DRC dialog
Fixes: lp:1824630
* https://bugs.launchpad.net/kicad/+bug/1824630
2019-04-13 11:23:57 -04:00
Seth Hillbrand 822cd9c6ef eeschema: Remove UR_WIRE_IMAGE
The wire image undo/redo option required special handling and was only
used in a single location.  Replacing with single change handling
reduces the code complexity
2019-04-13 07:11:24 -07:00
John Beard 203019d959 Fix GAL option spin button layout
These need to not be wxEXPAND and to be vertically centred
to match the adjacent text controls.

Fixes: lp:1804461
* https://bugs.launchpad.net/kicad/+bug/1804461
2019-04-12 23:35:54 +01:00
Seth Hillbrand d70ae19cb8 eeschema: Move realtime connectivity to adv config
This allows realtime connectivity testing by modifying the
kicad_advanced setting rather than recompiling
2019-04-12 08:37:44 -07:00
John Beard ab2281d26f GAL opts: move config reading into GAL_DISPLAY_OPTIONS
Move repeated GAL config reading routines into GAL_DISPLAY_OPTIONS.
THe app-level config is in here already, do the same for the
common config.

This means that the configs are loaded consistently, which fixes
the symbol-chooser preview window, which previously didn't use the
same config routine as other GAL canvases.

Future work could move these functions to free functions that
act on the public interface of GAL_DISPLAY_OPTIONS to avoid
GAL_DISPLAY_OPTIONS having to know about wxConfig and wxWindow.

Fixes: lp:1824524
* https://bugs.launchpad.net/kicad/+bug/1824524
2019-04-12 16:08:11 +01:00
Jeff Young 0021ecf51e Don't double-escape netnames.
Netnames in wxChoice or wxListBox are already in internal format
and don't need escaping again.

Fixes: lp:1823863
* https://bugs.launchpad.net/kicad/+bug/1823863
2019-04-12 00:28:58 +01:00
Jeff Young 3c11b89e4c Hook up refresh buttons to library tree synchronisation.
Fixes: lp:1820057
* https://bugs.launchpad.net/kicad/+bug/1820057
2019-04-11 19:45:10 +01:00
jean-pierre charras 63db3f7c17 Disable escaping special chars in netnames because it creates much more issues than it fixes.
Especially the netnames shown on screen are not those living in netlists,
breaking net info in Spice, Gerber X2 and IPC356 for instance
2019-04-11 18:36:21 +02:00
Seth Hillbrand 8c9244e677 Revert "eeschema: Connectivity threading"
This reverts commit 1a031e771f.

Some nets broken in commit.
2019-04-10 20:08:42 -07:00
Seth Hillbrand 1a031e771f eeschema: Connectivity threading
This threads the first step (update item) in the connectivity routine.
Also eliminates the duplicate call for multiple copies of the same
sheet.
2019-04-10 15:04:22 -07:00
Seth Hillbrand 2048114512 Reduce chance for wxPoint hash collision
Hash collisions reduce the speed of unordered maps by increasing the
comparison time of underlying values.  This implements the inverse
golden ration offset into the x value to ensure that consecutive points
are far from each other in the map.
2019-04-09 20:40:04 -07:00
Seth Hillbrand 257d9b5fe9 Allow setting the kicad config dir
This allows setting the config dir at build time, providing packagers a
method of controlling where the configuration files are placed.

Fixes: lp:1780601
* https://bugs.launchpad.net/kicad/+bug/1780601
2019-04-08 12:33:49 -07:00
Jeff Young adf3637476 Allow dialogs to veto mouse-warping when called from context menu.
Fixes: lp:1745731
* https://bugs.launchpad.net/kicad/+bug/1745731
2019-04-08 20:07:40 +01:00
John Beard dd17f24c04 Libeval: consistent formatting for NaN
On some platforms like MSVC, NaN prints as "-nan(ind)". This
is a bit needlessly ugly, so print "NaN" on all platforms
consistently.

This fixes a test failure on MSVC.
2019-04-08 16:27:45 +01:00
Jeff Young 77f15eeeaf Support synchronous messaging over KIWAY EXPRESS.
This allows us to make the various netlist and pcb update routines
more atomic and less reliant on carefully sequenced asynchronous
messages.

This is also a prelude to adding support for footprint testing
without a netlist.
2019-04-08 13:26:09 +01:00
Seth Hillbrand 24bf838392 pcbnew: Allow arc editing via midpoint
This permits changing the radius of the arc by adjusting the center
point of the arc.  The arc end points are fixed in this operation.
2019-04-07 06:50:25 -07:00
Jeff Young 4a9f82109a Uniformly quote strings which may have user content.
Fixes: lp:1655193
* https://bugs.launchpad.net/kicad/+bug/1655193
2019-04-07 00:24:10 +01:00
Jeff Young 684bb62fd8 Escape slashes in labels and netnames.
Also re-allows spaces, as they can already come in through sheet
names.

Fixes: lp:1798621
* https://bugs.launchpad.net/kicad/+bug/1798621
2019-04-07 00:24:10 +01:00
Jeff Young 2aad4a5e57 Remove dead code from removal of eeschema legacy canvas. 2019-04-05 15:54:31 +01:00
Michael Kavanagh 1ccef6dc80 Invert maximum and minimum endpoints on color picker sliders
Put the maximum values at the "top" of the sliders.

Fixes: lp:1823196
* https://bugs.launchpad.net/kicad/+bug/1823196
2019-04-05 14:37:46 +01:00
John Beard 0f39d4907f Regenerate DIALOG_COLOR_PICKER_BASE wxFB files
This avoids the wxFB automatic changes hiding substantive changes
to be made in later commits.
2019-04-05 14:37:46 +01:00
Jeff Young 0fb956cdbe Apply OSX select-all-when-tabbing fix to other platforms.
Fixes: lp:1822890
* https://bugs.launchpad.net/kicad/+bug/1822890
2019-04-03 22:15:02 +01:00
Seth Hillbrand db0523626c GAL: Deal with thick circles
Both Cairo and OpenGL had issues (different, though) with circles that are
thicker in line width than they have radius.  This corrects the OpenGL
implementation (radius is calculated to the outer edge) as well as Cairo
(line width needs to be clamped to twice the radius)

Fixes: lp:1822765
* https://bugs.launchpad.net/kicad/+bug/1822765
2019-04-02 17:19:20 -07:00
John Beard 6f1c3f5ef8 Eeschema: construct simulator cursors on demand
Statically constructing wxCursors as used for the probe
and tune cursors crashes the qa_eagle_plugin test
instantly.

Fix this by introducing a new class CURSOR_STORE,
which allows to abstract the platform wierdness of wxCursors
and allow the simulator to laziliy init its own cursors
at runtime.

This code isn't properly tested, as these cursors are never
actually used. However, it does allow the eeschema unit test
to run.

Fixes: lp:1781191
* https://bugs.launchpad.net/kicad/+bug/1781191
2019-04-02 18:26:33 +01:00
jean-pierre charras 5ebec518d0 DIALOG_SHIM: disable a debug trace (a printf in debug build), now not very useful.
(It can be re-enabled easily)
2019-04-02 11:54:29 +02:00
jean-pierre charras 0d2dd48cad geometry/geometry_utils.cpp: Fix a minimal value (6) to calculate the segments by circle count to approximate a circle.
Use also this minimal value to calculate  the circle to poly correction factor
Also, remove a useless code.
2019-04-02 11:33:35 +02:00
Jon Evans 83c7e7fc65 New connectivity algorithm and bus upgrades
Bus upgrades: core new connectivity code

Bus upgrades: eeschema integration and modifications

Bus upgrades: eeschema dialogs

Bus upgrades: netlist export

Bus upgrades: file format changes
2019-03-31 19:53:41 -04:00
jean-pierre charras 7170720f3c Allow hatch pattern in filled zones
the filled areas can use a hatch pattern (crossing lines) using square holes.
The zone filler removes too small holes (truncated holes) from hatch pattern.
It avoid to create small holes when a hole pattern is truncated by the filled area base shape.
2019-03-31 08:21:40 +02:00
Seth Hillbrand c1c4a0925d sim: Prevent stepping
Introduced by 416e64a334.  The code
appears to have been stepped on purpose but this would be incorrect for
most applications.  There remains a good deal of cleanup in mathplot
available for the motivated dev.

Fixes: lp:1810311
* https://bugs.launchpad.net/kicad/+bug/1810311
2019-03-26 14:56:33 -07:00
John Beard aef369f4af Fix MSYS2 build breakage
wxPlatformInfo::Get() causes a linker error on Msys2.

Fix this by making common link wx explicitly, rather
than implicity via it's dependencies, which cause
wrong-order linker command lines on windows.
2019-03-26 10:49:19 +00:00
John Beard 567bdd9b9d Add configuration of Hi-DPI canvas scaling in OpenGL
First, add automatic detection of toolkit DPI scaling options. For now, this
is, in order,

* Check the GDK_SCALE option under GTK+ (users can set this to force the scaling)
* Check the value from WX's GetContentScalingFactor(). This will start to work
  correctly from WX 3.1 and GTK+ 3.10.

Then, add a user-settable override in the main prefs panel, next to the icon
scaling. This is independent of the icon scaling options.

DPI handling is performed in a standalone class, so they can be shared between
the prefs UI and the OpenGL backend easily. Also means Cairo could use the same
interface in future.

Also adjust the OpenGL grid drawing code to use the computed scale factor,
which avoids over-thick grids in scaled environments (the user can manually
thicken the grid if wanted).

Fixes: lp:1797308
* https://bugs.launchpad.net/kicad/+bug/1797308
2019-03-25 15:00:55 +00:00
jean-pierre charras ecb168f7a7 Add MD5_HASH::Format for debug purposes. 2019-03-21 11:42:15 +01:00
Seth Hillbrand 078320e2fb Unify and correct Autosave functions
Autosave was not working correctly, partly due to different
implementations in eeschema and pcbnew and partly due to a mistaken
refactor at some point during v5 development.  This unifies the expected
autosave prefix to _autosave- for both pcbnew and eeschema.  It also
unifies the expected suffix for the backup files to -bak.

Fixes: lp:1820433
* https://bugs.launchpad.net/kicad/+bug/1820433
2019-03-18 10:25:26 -07:00
jean-pierre charras fb0b1f2617 Print on Linux: use 600 DPI instead of the default 72 DPI (noticeable in Pcbnew) 2019-03-17 17:21:32 +01:00
Seth Hillbrand f96d16eba3 Restore LINK_MAP linker options
Removing invalid TO_LINKER missed a few segments where it was used.
This fixes the ability to enable link maps
2019-03-16 20:37:14 -07:00
jean-pierre charras a1ee5405aa Fix missing definition of std::hash<wxPoint> when using wxWidgets 3.1.x
it was not compiled for wxWidgets 3.1.x, but it does not exist in 3.1.x
2019-03-14 17:33:25 +01:00
Wayne Stambaugh aef0221d3b Replace isdigit() with wxIsdigit() when testing wxString characters.
This is a continuation of commit 8a03025a.  All known instances of
using isdigit() to test a character in a wxString have been replaced
by wxIsdigit().
2019-03-14 09:47:14 -04: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
jean-pierre charras 80cf4ec5cb Add comments about SVG import. 2019-03-11 19:25:52 +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
Seth Hillbrand 9bfce26ce7 Move env var substitution into GetAssociatedDocument
We always want the documents to have their variables replaced when
opening the associated file.

Fixes: lp:1819309
* https://bugs.launchpad.net/kicad/+bug/1819309
2019-03-10 08:39:36 -07: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
Seth Hillbrand a7f3462637 Fix compile issue on Linux 2019-03-04 06:11:44 -08:00
Jeff Young 49aa2503a0 Use recent wxWidgets headers (which are backward-compatible).
Fixes: lp:1817965
* https://bugs.launchpad.net/kicad/+bug/1817965
2019-03-04 12:26:30 +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
Seth Hillbrand 8a03025ac9 strnumpcmp: Use wxstring functions for wxstrings
Fixes: lp:1818157
* https://bugs.launchpad.net/kicad/+bug/1818157
2019-03-03 19:55:50 -08:00
Seth Hillbrand 38be0fccb7 Symlib table: Need button handler for files
The folder button handler works will for footprint libraries but we
needed a specific class for the schematic libraries as well.

Fixes: lp:1818346
* https://bugs.launchpad.net/kicad/+bug/1818346
2019-03-02 20:05:28 -08: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
jean-pierre charras 140abd3952 Pcbnew: fix missing vertical grid lines in flip board view
Fixes: lp:1818154
https://bugs.launchpad.net/kicad/+bug/1818154
2019-03-01 11:09:40 +01:00
Seth Hillbrand 307a7154b6 DIALOG_SHIM: Enable Cancel button when editing
The cancel action was set for the escape key when editing the fields in
a dialog.  But when the action is a button, we need to ensure that the
escape id is set to ANY for processing.

Fixes: lp:1818056
* https://bugs.launchpad.net/kicad/+bug/1818056
2019-02-28 18:52:35 -08:00
Seth Hillbrand 13249b723b Handle excessive resize requests
For unknown reasons, GTK3 may send resize events when editing grid
fields.  This can cause the grid editor to exit, losing the focus and
overwritting the characters at the next input.

We avoid this by filtering the size events when the size doesn't change.

Fixes: lp:1817810
* https://bugs.launchpad.net/kicad/+bug/1817810
2019-02-27 11:32:30 -08:00
jean-pierre charras 29d7c0a1ec Excellon drill file: fix a very minor issue in a comment. 2019-02-27 10:41:55 +01:00
Seth Hillbrand 51fce4bad8 Force X11 on linux
Wayland is not yet compatible with wxWidgets (or rather the other way
around).  Until this happens, we must force the x11 compositor while
running.  Under wayland, this will map to the wayland-x11 compatibility
layer.

Fixes: lp:1816637
* https://bugs.launchpad.net/kicad/+bug/1816637
2019-02-26 08:51:12 -08:00
Seth Hillbrand 269f420f8d OpenGL: Create shaders for each GL
Fixes: lp:1817284
* https://bugs.launchpad.net/kicad/+bug/1817284
2019-02-25 09:31:42 -08:00
John Beard 787e410a55 Coverity fixes: lambda parameters by reference
For BUTTON_ROW_PANEL::BTN_DEF_LIST, the  button definition does not need to be
passed by value, by non-const reference avoids copies and this addresses the
Coverity warnings: 184130, 184134, 184140, 184167.

Also use a unique_ptr to clarify ownership sementics when handing widget
over to WX.
2019-02-25 13:37:51 +00:00
jean-pierre charras 4bf52b9266 Gerber output: add missing end of block to a structured comment in X1 format.
the comment line G04 #@! TF.CreationDate ... was missing the * (end of block) symbol.

Fixes: lp:1817547
https://bugs.launchpad.net/kicad/+bug/1817547
2019-02-25 14:16:36 +01:00
jean-pierre charras 8ad15b1d66 Symbol editor: fix issues related to axis not shown.
In Symbol editor, axis are always shown. However after switching the backend, axis were no longer drawn.
In Cairo engine, fix a bug preventing axis to be shown.
2019-02-24 12:56:17 +01:00
Seth Hillbrand 30612ca62d grid: Set grid to use integer pixels
Each dot is an integer number of pixels wide, so supporting 0.5 width
steps no longer makes sense.  We round up the existing settings to the
nearest integer and only allow integers in the dialog.

Fixes: lp:1816748
* https://bugs.launchpad.net/kicad/+bug/1816748
2019-02-23 19:27:45 -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
Seth Hillbrand cb352bb029 Set Page Layout preview scale and clear bg
The preview scale is always in mil, so leave the scale factor as implied
as 1;  Draw a white rectangle for the page layout preview background.
2019-02-23 06:22:27 -08:00
Seth Hillbrand 82cbe9c995 cairo: Don't adjust grid point size
We shouldn't adjust the pixel size of the grid based on alignment in
GAL.  This creates artifacts on the screen at different zoom levels.
The pixel width is fixed by grid size preference

Also clean a left-over debug statement

Fixes: lp:1817377
* https://bugs.launchpad.net/kicad/+bug/1817377
2019-02-22 15:31:27 -08:00
jean-pierre charras 99153950ec Pcbnew, Ruler tool: protect unit display against erroneous translation of \"
A only one char is very hard to translate outside a context, so avoid to use it.

Remove also 2 "FIX ME" lines, now useless.

Fixes: lp:1817354
https://bugs.launchpad.net/kicad/+bug/1817354
2019-02-22 20:47:55 +01:00
Seth Hillbrand 2305c5458e cairo: Prevent arch shaking in pcbnew
Arc pixel adjustment needs to be limited to +/-1 pixel.  But making this
adjustment to nearby points and then using the projection to correct the
center point accumulates errors that are large for angles near 0 and
near 360.  This is a compromise that aligns _most_ arcs and provides
stable generation for all angles.

Fixes: lp:1817226
* https://bugs.launchpad.net/kicad/+bug/1817226
2019-02-21 19:59:34 -08: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
Seth Hillbrand 066b1782bb cairo: Fix grid display
Grid points were uneven in Cairo compared to OpenGL.  This standardizes
the functions for grid types and simplifies the code
2019-02-21 10:49:56 -08:00
Jean-Samuel Reynaud 75eda69218 Fix compilation issue on PPC64 2019-02-20 09:44:03 -05:00
Seth Hillbrand 235f2c7b39 cairo: Fix dotted grid color
Fixes: lp:1816774
* https://bugs.launchpad.net/kicad/+bug/1816774
2019-02-20 06:30:19 -08:00
Seth Hillbrand 203486638b Cleanup and clarify Cairo code 2019-02-19 20:51:11 -08:00
Seth Hillbrand 484c1f63ba gtk3: Force GTK2-style input handling
GTK3 provides for additional input devices via xinput2.  These include
touchscreens and continuous scroll devices.  But wxWidgets does not have
specialized handlers for these events, so they double up for some
devices.  Until wxWidgets allows us to handle these events, we specify
that the input handler should be the old-style GDK_CORE.
2019-02-19 11:03:20 -08:00
Seth Hillbrand 69c1263c02 GTK3: Force scrollbars visible
GTK3 does a fade in/fade out routine for scrollbars by default.  This
was problematic as it caused a cascade of full-screen repaint events on
each mouse event.  Instead of disabling scrollbars (which only helped
the full canvas), we force the old scrollbar behavior is environmental
variables.

Revert "gtk3: Remove scrollbars"

This reverts commit db43bd82a7.
2019-02-19 10:52:39 -08:00
Seth Hillbrand 7d1a5c425c Cairo: Treat no stroke as an even line width
Also protect against 180° angle issues in arcs
2019-02-18 18:00:38 -08:00
Seth Hillbrand 467d37e3f0 cairo: Fix pcbnew arc drawing
Chord should be positive 90° off the arc
2019-02-18 17:05:59 -08:00
Tomasz Włostowski 3b3c674c1a gal: opengl: use correct radius for graphical circles 2019-02-19 01:55:50 +01:00
Seth Hillbrand 3a0dbffa9e cairo: Minor tweak for angle transforms
Need to swap angles before transforming or we get bad comparisons when
wrapping.
2019-02-18 16:42:49 -08:00
Tomasz Włostowski 2151e195c7 gal: cairo: don't forget about the color when drawing grid points... 2019-02-19 01:24:26 +01:00
Tomasz Włostowski f66baaed8c gal: cairo: pixel-align arc endpoints, not center to avoid misalignment with adjacent line segments 2019-02-19 01:21:20 +01: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
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 692fab2b73 WX_GRID::GetVisibleWidth(): fix column label height of our wxGrid, for multiline column labels 2019-02-18 20:02:00 +01:00
Seth Hillbrand 5af8d2d0a8 cairo: Fix rotated oval pads
Fixes: lp:1816428
* https://bugs.launchpad.net/kicad/+bug/1816428
2019-02-18 09:44:28 -08:00
Jean-Samuel Reynaud 8c69c81393 Adding support for PPC32 and PPC64.
Modification proposed by Gianluca Renzi.
2019-02-18 05:35:52 -08:00
Jiaxun Yang 320f4b6cd9 Add MIPS N64 support for libcontext 2019-02-18 05:14:21 -08:00
Tomasz Włostowski 632a619df9 gal: fixed broken lines in flipped board view (pixel alignment regression) 2019-02-18 11:27:12 +01:00
jean-pierre charras 3b97961ccb minor fixes (Coverity warnings and compil warning) 2019-02-17 15:33:20 +01:00
Jeff Young 076f07c683 Be more forgiving of large fonts in grids. 2019-02-17 10:38:06 +00:00
Seth Hillbrand f1a60832e0 opengl: Handle stroked semi-circles
And filled but we don't use those yet.  No pixel-alignment needed for
stroked semi-circles (I think) as we set the pixel width to be 1
regardless of the zoom level.

Fixes: lp:1816263
* https://bugs.launchpad.net/kicad/+bug/1816263
2019-02-16 19:57:23 -08:00
Seth Hillbrand 9d4a19797c cairo: Don't round locations of outlines
Pixel alignment is not required for track outline mode.  It creates
differences between segment and radius calculations.

Also add specific width of the outlines
2019-02-16 17:45:05 -08:00
Seth Hillbrand c84752b9a7 commit: protect against un-copyable error
This creates early asserts for issues where we haven't fully implemented
a Clone() function for items or haven't correctly filtered them before
creating the undo/redo commit.
2019-02-16 13:28:45 -08:00
Tomasz Włostowski 85a7ab7795 gal: minor cleanup & formatting 2019-02-16 20:25:10 +01: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 ec59361f75 Fix a few coverity errors 2019-02-16 14:09:21 +01:00
jean-pierre charras f364e81a91 Symbol editor: fix missing initialization in LIB_TREE_MODEL_ADAPTER::ColWidth().
The text size (in pixels) was never initialized (always 0) for the Column id 0.
2019-02-16 10:25:34 +01:00
Seth Hillbrand 813578eba6 Fix a few coverity errors 2019-02-15 20:15:04 -08:00
Seth Hillbrand 409ad04ab3 libtree: Fixing indent size for MSW
The indent size was estimated by the width of characters.  But MSW
indent is substantially different from OSX and Linux.  It also cuts off
the middle characters rather than the end leading to poor display if the
width does not fit.  This uses the system setting for indent to account
for the indent spacing + 'M' to account for the arrow inset.

Fixes: lp:1815401
* https://bugs.launchpad.net/kicad/+bug/1815401
2019-02-15 10:44:08 -08:00
Seth Hillbrand 227d6e3f9b Update copyright date in About Dialog 2019-02-15 09:32:27 -08:00
jean-pierre charras b848a424e8 minor fix 2019-02-15 15:35:31 +01:00
jean-pierre charras c8d44b86e2 Fix a compil issue with some compilers. 2019-02-15 08:47:03 +01: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 a74aa3850a libtree: Update width automatically
When filtering, we update the width of the displayed column to ensure
the full text is visible to the user.  Check is rough, based on line
width (doesn't completely account for differing char widths) but is
sufficient for the approximate difference

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

Fixes: lp:1788495
* https://bugs.launchpad.net/kicad/+bug/1788495
2019-02-12 21:56:47 -08:00
Jean-Samuel Reynaud 1c5cb947c1 Fix group tag for SVG plotting
This was previously "svg:g", but the SVG is declared with only
a "default" namespace, not an "svg:" namespace (looks like
xmlns:svg="http://www.w3.org/2000/svg" in the svg tag).

This means you cannot use svg: as a NS in the document. It's not
needed anywaY: the default is already correct.

Moreover, mismatching <svg:g> and </g> is always invalid.
2019-02-12 11:45:12 +00: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 f839278597 Fix exit dialog layout issue on windows.
Apparently FinishDialogSettings() does need to be called on windows to
get the dialog to layout properly.  Hopefully this doesn't break any of
the other platforms.
2019-02-11 15:26:03 -05:00
Seth Hillbrand c8cb9b3e1c Cleanup licensing
Add text of BOOST and ISC to source repo and clarify sources under each
in the README
2019-02-11 08:35:23 -08:00
Wayne Stambaugh 605d0ab3c1 Fix exit dialog issue on GTK3 builds.
The main text was cut off at the bottom.  Enabling wrapping seemed to
resolve the issue.
2019-02-10 19:07:38 -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 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
Wayne Stambaugh 0d2e39e781 Fix button padding in file/directory picker dialog. 2019-02-09 16:23:47 -05:00
John Beard d06f0de1eb Libedit: transfer current screen settings on part load
When loading a part in libedit, also transfer certain screen
settings to the incoming SCH_SCREEN, from the current
SCH_SCREEN.

Currently, the grid settings are transferred, but this could
also do other settings if needed.

Also remove some duplicate commentary and mention why the
grid is set in a SCH_SCREEN even though the BASE_SCREEN ctor
sets the same default.

Fixes: lp:1815108
* https://bugs.launchpad.net/kicad/+bug/1815108
2019-02-08 22:56:05 +00:00
jean-pierre charras 95af750fc9 Very minor fix in dialog_exit_base. 2019-02-08 08:16:10 +01:00
Seth Hillbrand 5da4e18664 bitmaps: Handle mask colors
Some transparent bitmaps use masking colors to show the binary
opaque/transparent.

Fixes: lp:1814893
* https://bugs.launchpad.net/kicad/+bug/1814893
2019-02-07 21:27:43 -08:00
Seth Hillbrand 591e4137d7 pcbnew: Exit Yes/No with escape key
Fixes: lp:1814957
* https://bugs.launchpad.net/kicad/+bug/1814957
2019-02-07 08:42:26 -08:00
John Beard 84d79ec10d QA: LIB_TABLE tests
Some basic tests on LIB_TABLE and LIB_TABLE_ROW that demonstrate
the behaviour of fallbacks and various access methods.

Also add a few LIB_TABLE_BASE comments and changed some NULLs to
nullptr.
2019-02-04 19:44:54 -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
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
Fabián Inostroza 7f6b35c6bc Don't start autopan if the cursor was warped
The application warps the cursor when initiating some actions (dragging,
selecting modules or Find and Move).  This warping should not also
trigger the autopan action.

Fixes: lp:1810787
* https://bugs.launchpad.net/kicad/+bug/1810787
2019-01-08 12:15:33 -08:00
Seth Hillbrand 90ad240660 units: Move common units and add tests
Centralizing duplicate code from Eeschema and pcbnew and adding unit
tests
2019-01-08 09:29:32 -08:00
Seth Hillbrand 1e5ba6f1b1 Replace DIM() macro
The standard DIM() macro was not typesafe as it happily deferred errors
to runtime that can be caught at compile time.  Replacing it with a
generic C++11 constexpr allows for typecasting, comparison and compile
time error checking.
2019-01-06 08:43:12 -08:00
John Beard cec97ebfa6 Remove unused VIRT_MIN/MAX from legacy_gal 2019-01-06 08:16:29 -08:00
John Beard 5e705347bb Libeval: Use add_custom_target so grammar.c won't be cleaned
If you use add_custom_command to generate the grammar file,
it can be removed by "make clean". This then means the user will
need to get it back from Git, or regenerate it with Lemon.

Changing to add_custom_command removes the output file
from the clean list. The incantation to rebuild the grammar
remains the same: "make libeval_grammar", and it is still not
required to have lemon installed for a normal build.

Fixes: lp:1809610
* https://bugs.launchpad.net/kicad/+bug/1809610
2019-01-05 07:44:06 -08:00
Seth Hillbrand 30521f0c57 gal: Fix zoom extents for large screens
When at small zoom levels, the integer bbox can overflow, preventing
redraw.  We fix this by redrawing the full tree when this happens

Fixes: lp:1733067
* https://bugs.launchpad.net/kicad/+bug/1733067
2019-01-04 16:00:31 -08:00
Seth Hillbrand 3a3bbbb545 GAL: Add transparency for bitmaps and Cairo draw
Bitmaps loaded via wx can contain alpha channels.  We utilize underlying
routines to correctly map the alpha.  This also standardizes the Cairo
alpha calls to ensure correct display in Fallback for partially
transparent highlights

    Fixes: lp:1809845
    * https://bugs.launchpad.net/kicad/+bug/1809845
2019-01-04 13:40:19 -08:00
Seth Hillbrand e8333633fe GAL: Add antialiasing options to Cairo
Cairo supports antialiasing when rendering but can be slow when set to
sub-pixel mode.  This bumps the minimum version of Cairo to 1.12
(available in 14.04 LTS as well as mingw) to support three antialias
settings (fast, good, best) that offer speed/appearance tradeoffs.

This can provide a higher-quality eeschema render as it works on a
per-element basis as opposed to the OpenGL per-screen antialias.
2019-01-04 13:39:56 -08:00
John Beard b743c39ed8 On start without config, start pcbnew in Cairo GAL
Currently, GAL is initialised to NONE (i.e. off). This causes
issues when Legacy canvas is broken (i.e. GTK3).

This changes the default to GAL Cairo, both in PCB_EDIT_FRAME
init, and in the config load.

Now, when the user starts with no config, they are prompted for
a choice: OpenGL or Cairo, and one of them will be set up, with
Cairo as fall back.

Users on platforms that still support legacy can go to it as normal
from the menu, but it will not be the default in any circumstance.

Fixes: lp:1809997
* https://bugs.launchpad.net/kicad/+bug/1809997
2019-01-04 15:22:34 -05:00