Commit Graph

4056 Commits

Author SHA1 Message Date
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
jean-pierre charras 56e0031e03 Fix incorrect onScroll handler on GAL mode.
If a Scroll event is skipped, a default handler is fired by wxWidgets.
This default default handler fires 3 wxEVT_SCROLLWIN_LINEUP or wxEVT_SCROLLWIN_LINEDOWN events.

This is not wanted now in eeschema (and pcbnew) because they add extra (unwanted) scrolling.

Fixes: lp:1810403
https://bugs.launchpad.net/kicad/+bug/1810403
2019-01-04 13:10:34 +01:00
jean-pierre charras db7dba96ad Fix a few Coverity warnings.
Mainly not initialized members, and replace not tested dynamic_cast by static_cast.
2019-01-04 09:49:21 +01:00
Seth Hillbrand 7d06651a10 Change top selection drop-down to combobox
wxChoice centers the selection on GTK.  So when switching from a
mid-list item to an item at the top, the list is always cut off for
choice lists located on the top toolbar.  Using a combobox provides a
drop-down that allows easier access to all elements in the box.

Fixes: lp:1808569
* https://bugs.launchpad.net/kicad/+bug/1808569
2019-01-03 14:48:28 -08:00
Seth Hillbrand 9f8f938660 view: Initialize keyboard local var 2019-01-02 19:45:09 -08:00
jean-pierre charras 4b7ef22ec4 Fix wildcard list when built on GTK 2019-01-01 17:04:40 +01:00
jean-pierre charras 14ede151cc Add a helper function FileExtListToFilter() to build the wildcard filter used in File Dialog.
It avoid including these extensions in a translatable string, thus avoid breaking filter
if the translation is incorrect (It happens sometimes).
See wildcards_and_files_ext.cpp for use.
2019-01-01 15:38:57 +01:00
jean-pierre charras 26a337db18 Opengl engine: temporary disable bitmaps cache, because it creates serious issues in cross-probing in hierarchies.
If a page layout contains bitmaps and is used in all sheets of a hierarchy, and in the board editor,
the cross-probing from pcbnew to eeschema invalidate textures associated to these shared bitmaps,
when switching active sheets.
Usually a crash happens after switching or when closing editors.

As a workaround, I disabled bitmaps (therefore associated textures) cache.
Not optimal, but at least it avoid crashes.
2018-12-30 20:30:43 +01:00
Maciej Suminski ad07b4a251 Added an explanation for using wxFileConfig in GetNewConfig() 2018-12-29 19:22:07 +01:00
John Beard e919ded35f Use wxFileConfig, not wxConfig
The wrong class is called for the ctor of the wxConfigBase - this should
be a wxFileConfig, just like the bare new used to be.

Fixes: lp:1810002
* https://bugs.launchpad.net/kicad/+bug/1810002
2018-12-29 08:16:40 -05:00
John Beard e856a7a09c Disable legacy canvas on GTK3
This make the use of legacy canvas on GTK3 a default-off
advanced config. Legacy is substantially broken on GTK3
and is of basically no use at all to general users on this
platform.

If the program starts with legacy canvas in the config,
it is forced into a GAL mode, as otherwise it could happen
that the user is stuck and unable to get into pcbnew to change
the setting.

Fixes: lp:1803156
* https://bugs.launchpad.net/kicad/+bug/1803156
2018-12-28 11:36:09 -05:00
John Beard 892f7cf8ff Make SVG import an advanced config, not a compile option.
This demos the advanced config and allows no-recompile switching
of the SVG importer. It also allows the import manager to be
tested more completely.
2018-12-28 11:36:09 -05:00
John Beard a33a8292a4 Run-time config for advanced options
This can be used for "advanced" options which are for developers
to use for feature-flags and other configuration. Run time config
has some advantages over preprocessor defines:

* Can be changed without recompilation
   * Sensitive to XDG_CONFIG_DIR, so flipping configs is easy
* Better compiler coverage (less conditionally compiled code means
  less chance to break a different configuration). Also better
  analysis coverage.
* Type safe config params
* Centralised documentation: it's in doxygen, in one place

No advanced config should be required by a general users. If a general
user does use one of these configs, it's probably because:

* There is a bug and one of these configs is a workaround
* A config in here is generally useful and should be moved into the
  relevant application config and given UI.

For now, the config is read-only, and is read from the
"kicad_advanced" config file in the normal config dir.
2018-12-28 11:36:08 -05:00
jean-pierre charras 9f21d32563 Fix a compatibility issue with wxWidgets 3.1.2 (MSW specific) 2018-12-28 15:30:22 +01:00
jean-pierre charras 8cc3912b6c Zoom context menu: minor enhancement (gal mode). 2018-12-28 14:08:01 +01:00
Jeff Young f6e6ac3162 Don't issue errors for externally-defined env variables.
Fixes: lp:1809300
* https://bugs.launchpad.net/kicad/+bug/1809300
2018-12-26 21:36:04 +00:00
Tomasz Włostowski 5b4e6b21f2 SELECTION_AREA: ensure single-pixel-wide selection rectangle border
Fixes: lp:1801558
* https://bugs.launchpad.net/kicad/+bug/1801558
2018-12-24 15:35:25 +01:00
Tomasz Włostowski 3adb8d56c5 OPENGL_GAL: no need to draw line caps when drawing a polyline, the shader takes care of them already 2018-12-24 15:35:25 +01:00
Tomasz Włostowski 029fdaccc0 gal: re-enable scrolbar arrow buttons
Fixes: lp:1690780
* https://bugs.launchpad.net/kicad/+bug/1690780
2018-12-24 15:35:25 +01:00
Tomasz Włostowski bebbe6ed22 pcbnew: disable autopanning when cursor entered auto-pan margin following a keyboard cursor move command
Fixes: lp:1803523
* https://bugs.launchpad.net/kicad/+bug/1803523
2018-12-23 18:58:12 +01:00
jean-pierre charras dde933ba08 When printing, pads are not always printed (especially on tech layers)
A printing mode is added, to force ViewGetLOD() to return 0 in printing mode (pads are always drawn)

Fixes: lp:1809528
https://bugs.launchpad.net/kicad/+bug/1809528
2018-12-22 13:44:49 +01:00
Jeff Young 4c184f07a6 Clean up undo when cancelling block operation.
Fixes: lp:1809444
* https://bugs.launchpad.net/kicad/+bug/1809444
2018-12-21 22:45:57 +00:00
Seth Hillbrand db43ed72fe swig: clear up some warnings 2018-12-20 11:04:55 -08:00
Maciej Suminski 24f9bfa13b Fixed memory leaks
This is commit a9efbf47 with a fix for SWIG to deal with unique_ptr.
2018-12-20 10:05:58 +01:00
jean-pierre charras 83d851956c classes MARKER rework: remove duplicate code. Better HitTest code (HitTest takes in account the actual shape) 2018-12-19 19:53:27 +01:00
jean-pierre charras 15843ae01a class MARKER rework: fix a few minor issues, remove duplicate code and add comments. 2018-12-19 15:13:31 +01:00
Seth Hillbrand 64f1fb9e79 tesselation: Re-check polygon count after fracturing
The fracture() call may result in zero polygons remaining, which will
cause failure in our tesselation routine, so we need to check whether
this is a valid POLYGON before re-tesselating.
2018-12-18 13:49:13 -08:00
Seth Hillbrand 2498da2745 Tesselation: Only set valid when successful
Tesselation can fail for a number of reasons.  When this happens, we set
the triangulationValid flag to false to prevent using the broken
triangulation.  This will fall back to the slow OpenGL triangulation
when DrawPolygon is called.
2018-12-18 09:16:16 -08:00
jean-pierre charras 388397f97d Protect TesselatePolygon() against degenerated polygons (less than 3 corners) to avoid crashes.
Use TesselatePolygon() to draw polygons in Gerbview instead of GLU tesselation, much slower.
Add helper methods in GAL to know if the current GAL engine is Cairo, OpenGL or something else,
useful to optimize drawing code.
2018-12-18 12:49:14 +01:00
Seth Hillbrand 657bf2b53e tesselation: In case of failure, re-fracture
Simplification with clipper can produce a polygon with holes.  We need
to re-call simplify followed by fracture to ensure valid triangulation
2018-12-17 17:02:32 -08:00