Commit Graph

4353 Commits

Author SHA1 Message Date
Seth Hillbrand efc0325e14 Handle wx scrollbar thumbs in system-independent way
The thumb size changes between system versions and (on GTK) render
managers, so hard-coded wasn't working.  This gets the actual value from
the system and uses to adjust the range.  Changes in the range can also
trigger the refresh.

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

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

(cherry picked from commit 85df994eda)
2019-08-22 10:16:25 -07:00
Seth Hillbrand 213547f545 SVG: Correct plot fills for arcs/polylines
When plotting in Eeschema, various elements may be filled with either
the foreground or background colors.  The fill mode is rather unique,
requiring un-stroked pie wedges for arcs and both closed and open filled
polylines.

Fixes: lp:1840769
* https://bugs.launchpad.net/kicad/+bug/1840769
2019-08-20 12:01:00 -07:00
Seth Hillbrand ebba15fe67 Alphabetize Library Table returns
KiCad is case sensitive but we need to be consistent in displaying sort
order as case insensitive (same as file systems)

Fixes: lp:1836911
* https://bugs.launchpad.net/kicad/+bug/1836911
2019-08-19 15:23:29 -07:00
Jeff Young c1cd3339fa Fix assertion in new Duplicate Hotkey warning message. 2019-08-19 14:24:26 +01:00
Seth Hillbrand dc0aed5b16 Allow EDA_RECT to properly be uninitialized
The base initialization of EDA_RECT sets a 0/0/0/0 rectangle that
prevents merging properly with valid EDA_RECT.  This sets the default to
be uninitialized until the internal data are set.

(cherry picked from commit 46feb76aba)
2019-08-16 11:01:01 -07:00
Simon Schubert a68a442bbb SVG plot: output invisible text in addition to plotting
Fixes: lp:1544918
* https://bugs.launchpad.net/kicad/+bug/1544918

(cherry picked from commit 176fe80425)
2019-08-15 14:32:32 -07:00
Shawn Anastasio f6a42a36d6 Fix libcontext on PPC64 ELFv2
libcontext currently restores and saves the FPSCR register
on ppc64. This behavior is fine (though unnecessary) on the
ELFv1 ABI which designates the register as volatile, but has
been observed to cause crashes on ELFv2 systems.

The ELFv2 ABI designates the FPSCR register as Limited-access
and specifies specific conditions that must be met to clobber
it. It does not seem that a context swap function meets these
conditions (and indeed, the save/restore register example in the
ABI document does not modify FPSCR).

This patch fixes ELFv2 ABI compliance by removing the FPSCR
save/restore code in libcontext entirely. This fixes observed
crashes on the platform and should have no consequence for
ELFv1 support.

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

(cherry picked from commit 3e22b75948)
2019-08-14 11:18:25 -07:00
jean-pierre charras 8373e91a1b Python scripting: fix missing definition of uint32_t (and some other similar defs).
Fixes: lp:1837867
https://bugs.launchpad.net/kicad/+bug/1837867
2019-07-27 08:22:10 +02:00
Stefan Hamminga e7f3851212 Rebased LTO fix for coroutines
Fixes: lp:1793329
* https://bugs.launchpad.net/kicad/+bug/1793329

(cherry picked from commit e58d9606dd)
2019-07-25 12:17:11 -07:00
Seth Hillbrand b6fe4ff637 eeschema: Clean up backup name
This fixes the last suffix that was missed by 168fa09f5.  The schematic
backup files should have the suffix .sch-bak to distinguish from
.kicad_pcb-bak or other backups.
2019-07-23 10:47:15 -07:00
Jeff Young 16f9e697ab Allow edits to self-intersecting polygons.
1) Intermediate states might be self-intersecting, and we shouldn't
be policing our users on what order to do things in
2) The polygon might already be self-intersecting, at which point we're
preventing the user from fixing it.

Also includes better const management for SHAPE_POLY_SET API.

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

(cherry picked from commit a3c74051c2)
2019-07-14 18:36:47 +01:00
Jeff Young 6ba2c44e88 Add FootprintExists() which can be more careful about FS differences.
(And in particular, MSW's case-insensitive FS.)

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

(cherry picked from commit 20036f8105)
2019-07-11 23:01:25 +01:00
Seth Hillbrand 85f88b6b05 Fix case-sensitive import using KiCad std
Fixes: lp:1832853
* https://bugs.launchpad.net/kicad/+bug/1832853

(cherry picked from commit 79e2000af4)
2019-07-10 10:33:03 -07:00
Ian McInerney 40ba502853 pcbnew: Clean up warnings with unit handling in the DXF export
(cherry picked from commit ff9d899ae0)
2019-07-10 12:42:54 -04:00
Jeff Young 85220591e2 Fix bugs in keyboard cursor movement.
1) Generate refreshPreview events so the modern toolset doesn't
fall behind by one event (see LP:1818667)
2) In the legacy toolset don't call unimplemented routines and don't
snap to grid on the non-movement axis.
2019-07-05 01:32:15 +01:00
Seth Hillbrand 3974c6fd89 Enforcing rational limits on length tuner
The length tuning dialog needed validators on close to prevent negative
and percentages >100%

Fixes: lp:1834734
* https://bugs.launchpad.net/kicad/+bug/1834734
2019-06-29 09:37:47 -07:00
jean-pierre charras 032bda223e Gerber drill file: Modify a aperture attribute for oblong holes (slots).
Oblong holes (slots) use now a aperture attribute similar to round holes.
(The previous attribute "slot" is now deprecated)
However they have a specific aperture, and a comment is added in drill files for these apertures.
2019-06-26 17:53:09 +02:00
Tomasz Włostowski 3bf7ab910f TestSegmentHit: add corner case for null segment (start == end)
Fixes: lp:1833059
* https://bugs.launchpad.net/kicad/+bug/1833059

(cherry picked from commit 6180687bbd)
2019-06-25 08:45:27 -04:00
Seth Hillbrand b124599de3 Don't skip handled events in GTK
Now that our tool framework handles the hotkeys, we need to skip the
passed handling work-around for actions that are already handled in the
event.

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

(cherry picked from commit b876309999)

Fixes: lp:1819210
* https://bugs.launchpad.net/kicad/+bug/1819210
2019-06-18 22:06:10 -07:00
Wayne Stambaugh 43579f4c02 Minor library identifier validator change.
Use the wxTextValidator style flag to allow the user to clear the library
identifier string.  Use wxTextValidator::SetStyle( wxFILTER_EMPTY ) to
prevent empty library identifier strings which is the current behavior.

(cherry picked from commit 9f9e87f11f)
2019-06-18 12:16:51 -04:00
Seth Hillbrand b32439a694 Plotting: Handle mask transparency
This handles images with transparent colors by mapping the transparent
color to white.  This only works when plotted into the background.
2019-06-17 13:27:58 -07:00
Seth Hillbrand b075886b19 DC printing: Place worksheet behind schematic
And place bitmaps behind other items.  This ensures they are drawn in
the background of the page rather than covering schematic elements.

This also hacks around the buggy wxPostScriptDC implementation that
resets the page to print an image.

Fixes: lp:1819934
* https://bugs.launchpad.net/kicad/+bug/1819934
2019-06-17 13:03:00 -07:00
Seth Hillbrand 77f0799750 Print bitmaps using BW setting
When selecting the "Print in B&W", all items on the schematic should be
printed using black and white.  This converts the embedded images
greyscale before outputting to the printer
2019-06-17 09:54:52 -07:00
Wayne Stambaugh 8002692f3e CvPcb: fix save changes dialog layout issue.
DIALOG_EXIT was not being laid out correctly after setting the dialog
message.  Rather than fix our custom DIALOG_EXIT, wxMessageDialog and
wxRichMessageDialog were substituted as direct replacements for all
of the variants of DIALOG_EXIT.  This make message dialogs appear more
consistent because wxMessageDialog uses the default platform message
dialog and wxRichMessageDialog uses the default platform rich message
dialog on windows.

Remove DIALOG_EXIT_BASE as it is no longer required.

Fixes lp:1832899

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

(cherry picked from commit 3f665318f4ab5c02b7d3c29b5233a273fdac2e4e)
2019-06-16 12:28:35 -04:00
Seth Hillbrand 9496b57b01 tool_mgr: Don't invalidate our own iterators
Re-arranging the stack will invalidate the iterator that is removed and
inserted (begin()).  Because this is not a threaded operation, we can
only do it to ourselves, so check that the operation isn't a NOP before
performing.

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

(cherry picked from commit 552815d486)
2019-06-15 17:49:52 -07:00
jean-pierre charras a5cd5844ec Fix invalid wxImageList build.
Fixes: lp:1832905
https://bugs.launchpad.net/kicad/+bug/1832905
2019-06-15 16:08:07 +02:00
Ian McInerney da16b479a0 Make DXF monochrome output only contain Black layer
Fixes: lp:1832359
* https://bugs.launchpad.net/kicad/+bug/1832359

(cherry picked from commit dc56678289)
2019-06-13 16:10:17 -07:00
Ian McInerney 44f1059000 Allow DXF to be exported in either inches or millimeters
Fixes: lp:1832188
* https://bugs.launchpad.net/kicad/+bug/1832188

(cherry picked from commit d5f680ecd2)
2019-06-13 16:10:12 -07:00
Seth Hillbrand a84ca5b147 cmake: Further petting dependencies
eeschema cpp files consume generated header files that have targets in
the common directory, so no dependencies get created from eeschema.  We
add the dependencies in common to force the setting through libraries.

Fixes: lp:1831643
* https://bugs.launchpad.net/kicad/+bug/1831643
2019-06-13 16:09:45 -07:00
Ian McInerney 2aa8e444ee Added hotkey validity checking to the preferences menu 2019-06-13 13:53:04 -04:00
Steven A. Falco cfa187f477 Show the current grid setting. 2019-06-13 12:14:41 -04:00
Seth Hillbrand 0ee38653f7 Fix default User Template location
When we assign a string to the wxFilename, it takes the last section as
the filename (unless there is a trailing '/').  So on Linux, we got
/home/user for the Documents dir and /home/ was the directory while
'user' was the filename.  Appending directories 'kicad/templates' made
the final directory '/home/kicad/templates'.  Forcing this to be a
directory restores correct behavior.
2019-06-11 13:46:10 -07:00
jean-pierre charras 407301a28c Fix issue in cairo_gal when drawing a 360 deg arc (in fact a circle). It was due to a angle normalization between -360 and 360 degrees. So, in arcs, if the start angle and end angle diff is n*360 deg, this normalization gives start angle = end angle. The fix forces end angle = start angle+360deg in this case.
Fixes: lp:1832096
https://bugs.launchpad.net/kicad/+bug/1832096
2019-06-09 11:09:43 +02:00
jean-pierre charras 1113e18c40 Fix incorrect initialization of some menuitems IDs.
Although is is currently working, it is a potential issue.
2019-06-06 08:01:24 +02:00
Jon Evans 02947345e8 Mathplot: properly set foreground color when saving screenshots
Fixes: lp:1810914
* https://bugs.launchpad.net/kicad/+bug/1810914

(cherry picked from commit 27a5ed1a9f)
2019-06-05 22:44:18 -04:00
Seth Hillbrand 63f18f0b03 CMake: Handle custom_target indirection
Building custom targets that depend on custom commands such as our
keyword lexer requires two layers of indirection to pick up changes
properly and not overwrite the same file in parallel builds.

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

(cherry picked from commit c6af38477d)
2019-06-05 13:10:00 -07:00
Jon Evans 64b71644bb Zoom to fit: only consider worksheet if there are no other items
(cherry picked from commit 04d6ec7de7e7f90482310311fcee416e8ed6410f)
2019-05-29 20:52:07 -04:00
Ian McInerney b485e78030 gal: Decoupled X and Y grid step sizes
Made the X and Y step sizes for the grid separate in the GAL.

Cleaned up the types inside the DrawGrid functions.

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

(cherry picked from commit 45f10fcff1)
2019-05-28 20:37:07 -07:00
Jon Evans 4adf89b40b Improve image alpha handling in PDF and PS plotters
Fixes: lp:1825276
* https://bugs.launchpad.net/kicad/+bug/1825276
2019-05-27 12:35:12 -04:00
Seth Hillbrand b4e70e56a6 Eagle: Fix crash when importing Eagle V6
This fixes multiple issues when importing Eagle V6 files.

Crashes occured when arcs of 0-length were found and when parts were
referenced in the schematic that were not found in the library.  This
could happen if the library and schematic were different cases.

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

(cherry picked from commit 0e5cc54ec9)
2019-05-26 20:34:05 -07:00
Jon Evans 720b26d11e Eeschema: fix worksheet and background color for printing
Fixes: lp:1820611
* https://bugs.launchpad.net/kicad/+bug/1820611
2019-05-26 14:25:57 -04:00
Jon Evans e35be13b23 Eeschema: use worksheet color when plotting
Fixes: lp:1825568
* https://bugs.launchpad.net/kicad/+bug/1825568
2019-05-26 12:21:08 -04:00
Jon Evans ba19d93df9 GerbView: Fix selection of the last two grid settings
Fixes: lp:1827642
* https://bugs.launchpad.net/kicad/+bug/1827642
2019-05-25 17:14:35 -04:00
Jon Evans f101934909 Report actual intersection position for crossing tracks
Fixes: lp:1825588
* https://bugs.launchpad.net/kicad/+bug/1825588
2019-05-25 15:02:06 -04:00
Jon Evans ede2575018 Exclude invisible items from view bounding box for zoom-to-fit
Fixes: lp:1116457
* https://bugs.launchpad.net/kicad/+bug/1116457
2019-05-25 10:44:15 -04:00
Seth Hillbrand 691c6614a8 Plotter: Ensure group style is respected in SVG
Graphics Changed is cleared when setting graphics for a group but needs
to be reset when the group ends.

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

(cherry picked from commit 1a56dfe342)
2019-05-23 09:48:38 -07:00
Seth Hillbrand 6f34f95c52 Allow squared inflation and inflate Eagle Zones
Sometimes we want to inflate a polygon without adding rounded edges.
This add the option using the jtMiter setting.

This is used in the Eagle parser to expand the Eagle zones for KiCad.
Eagle Zones are drawn on the polygon edge, so they extend out from the
outline.  KiCad zones are drawn inside the polygon.  We need to both
increase the zone size and decrease the minimum pen width to account for
this.

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

(cherry picked from commit 490c805319)
2019-05-22 10:38:16 -07:00
Jon Evans b00e20b23f GerbView: fix saving of canvas type and lingering legacy menu item
Fixes: lp:1829647
* https://bugs.launchpad.net/kicad/+bug/1829647
2019-05-19 15:28:27 -04:00
Wayne Stambaugh deb387f54c 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.

(cherry picked from commit f08d040c02)
2019-05-15 18:19:40 -04:00
Seth Hillbrand 5d5422b4c5 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.

(cherry picked from commit a0f477cc5f)
2019-05-15 14:55:12 -07:00
Seth Hillbrand 85b8dd8b34 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.

(cherry picked from commit 0eb391b13f)
2019-05-15 14:55:00 -07:00
Wayne Stambaugh b93d34dff4 Fix GAL display options panel spin button layout on windows.
Fixes lp:1829224

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

(cherry picked from commit d34433a1df)
2019-05-15 15:01:00 -04:00
Wayne Stambaugh d3c9154f9a 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
(cherry picked from commit 3c4f8c1bf7)
2019-05-13 16:22:52 -04:00
Wayne Stambaugh 8e93eda449 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
(cherry picked from commit ae54f34392)
2019-05-10 09:16:38 -04:00
jean-pierre charras c489659a20 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:24:39 +02:00
jean-pierre charras cebba6c0b9 Cairo GAL: fix incorrect arc position in mirror mode. the previous fix
(c56e540e5d) did not really work.

Fix from master branch.
2019-05-08 14:25:14 +02:00
John Beard 89f9bf545d 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

(cherry picked from commit e6fe220f84)
2019-05-08 11:07:45 +01:00
Adrian Scripca 055d36abd7 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
(cherry picked from commit e10c01aaff)
2019-05-07 17:36:23 +01:00
John Beard 7bafc5fa8b About dialog: Add mnemonics to the buttons
(cherry picked from commit 4a3add7ac5)
2019-05-07 11:15:13 +01:00
John Beard 6946c0bedb About dialog: update wxFB version
Avoid contaminating wxFB files with version fluff, which hides real
changes in the version history.

(cherry picked from commit cc28fb18fd)
2019-05-07 11:15:13 +01:00
jean-pierre charras c56e540e5d 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:30:15 +02:00
Wayne Stambaugh 616061a6ca 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
(cherry picked from commit 7d803437e2)
2019-05-02 12:13:30 -04:00
John Beard 434935613c 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

(cherry picked from commit 10900c918f)
2019-04-28 17:18:09 +01:00
John Beard 454585d3d2 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).

(cherry picked from commit fcc4a84e0e)
2019-04-27 14:58:50 +01:00
John Beard 20c8b094d6 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.

(cherry picked from commit d89d0e6b74)
2019-04-25 23:51:01 +01:00
Tomasz Włostowski 9743eec3ab 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

(cherry picked from commit 5813164d15)
2019-04-25 23:51:01 +01:00
jean-pierre charras 583d416640 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-17 14:55:14 +02:00
John Beard ab39f06003 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.

(cherry picked from commit e312e2b286)
2019-04-17 11:29:28 +01:00
Jon Evans f90049dd9e Veto mouse warping from DRC dialog
Fixes: lp:1824630
* https://bugs.launchpad.net/kicad/+bug/1824630

(cherry picked from commit dec5d80180)
2019-04-13 11:30:21 -04:00
Jeff Young 90787e84bf Allow dialogs to veto mouse-warping when called from context menu.
Fixes: lp:1745731
* https://bugs.launchpad.net/kicad/+bug/1745731

(cherry picked from commit adf3637476)
2019-04-13 11:30:09 -04:00
John Beard c36c80a077 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

(cherry picked from commit 203019d959)
2019-04-12 23:36:56 +01:00
John Beard 2d43fcf9ee 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

(cherry picked from commit ab2281d26f)
2019-04-12 16:48:50 +01:00
John Beard 322524101d 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.

(cherry picked from commit dd17f24c04)
2019-04-08 16:29:24 +01:00
Michael Kavanagh 0c8a95c44b 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

(cherry picked from commit 1ccef6dc80)
2019-04-05 14:38:48 +01:00
John Beard 403633d21f Regenerate DIALOG_COLOR_PICKER_BASE wxFB files
This avoids the wxFB automatic changes hiding substantive changes
to be made in later commits.

(cherry picked from commit 0f39d4907f)
2019-04-05 14:38:48 +01:00
jean-pierre charras 4c94e2729f 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.

(cherry picked from commit 0d2dd48cad)
2019-04-03 16:25:52 -07:00
Seth Hillbrand c75bd89d63 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

(cherry picked from commit db0523626c)
2019-04-03 16:03:49 -07:00
John Beard d4883da98b 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

(cherry picked from commit 6f1c3f5ef8)
2019-04-02 19:08:26 +01:00
Seth Hillbrand 082bbd49e7 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

(cherry picked from commit c1c4a0925d)
2019-03-26 14:59:18 -07:00
John Beard 4e2e69c9cb 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.

(cherry picked from commit aef369f4af)
2019-03-26 10:53:31 +00:00
John Beard 6f78bb6960 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

Cherry-pick of: 567bdd9b9 (master)
2019-03-25 15:16:18 +00:00
Seth Hillbrand 168fa09f5f 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

(cherry picked from commit 078320e2fb)
2019-03-18 10:27:09 -07:00
jean-pierre charras bd693f97a1 Print on Linux: use 600 DPI instead of the default 72 DPI (noticeable in Pcbnew) 2019-03-17 20:52:42 +01:00
Wayne Stambaugh f7b4a20066 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-15 15:54:49 -04:00
Seth Hillbrand de22148b44 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

(cherry picked from commit 9bfce26ce7)
2019-03-10 10:44:23 -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