Commit Graph

4181 Commits

Author SHA1 Message Date
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