Commit Graph

302 Commits

Author SHA1 Message Date
Jeff Young ba36fc0009 Fix some Coverity issues. 2020-03-25 14:38:43 +00:00
jean-pierre charras 5f7bcb9c34 3D viewer: fix a minor issue in solder paste rect pads:
the solder paste mask clearance was no taken in account for rect and trap shapes.
2020-03-25 13:04:30 +01:00
Jeff Young d69ebfae49 Push tool framework base down into TOOL_HOLDER.
This allows us to use it outside of EDA_BASE_FRAMEs (in this case, in
PANEL_PREVIEW_3D.)
2020-03-24 19:00:25 +00:00
Jeff Young 103b0c18de Hook up a few more 3D commands missed in last commit.
Fixes https://gitlab.com/kicad/code/kicad/issues/4074
2020-03-21 01:29:30 +00:00
Jeff Young e9cd9ee8ff Actionize the rest of the 3D viewer.
Fixes https://gitlab.com/kicad/code/kicad/issues/2228
2020-03-19 15:10:32 +00:00
jean-pierre charras b7cd0c54c2 Fix compil issues, especially on Windows:
Replace SEVERITY_ERROR by RPT_SEVERITY_ERROR to avoid collision with a system definition.
Replace other SEVERITY_XXX by RPT_SEVERITY_XX for consistency.
Fix compil warnings and some other compil issues.
2020-03-04 10:48:18 +01:00
Jeff Young 85c2e0d23a Add user-defined severities, exclusions and colors to DRC markers.
Exclusions are currently persisted in the project file.

Fixes https://gitlab.com/kicad/code/kicad/issues/1989
2020-03-04 00:39:28 +00:00
Jon Evans e59a3d981e Implement a new settings framework across all of KiCad
CHANGED: Settings are now stored in versioned sub-directories
ADDED: First-run dialog for migrating settings from a previous version
CHANGED: Settings are now stored as JSON files instead of wxConfig-style INI files
CHANGED: Color settings are now all stored in a separate settings file
CHANGED: The symbol editor and footprint editor now have their own settings files
CHANGED: Color settings are no longer exposed through BOARD object
CHANGED: Page layout editor now uses Eeschema's color scheme

Settings are now managed through a central SETTINGS_MANAGER held by PGM_BASE.
Existing settings will be migrated from the wxConfig format on first run of each application.
Per-application settings are now stored in one class for each application.
2020-02-19 23:44:56 -05:00
jean-pierre charras 0049185d06 Eeschema: Speed up global changes in DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS.
Previously, OnModify() was called for a lot of items, even when not modified.
For large schematics, the calculation time was unreasonable ( several minutes)
It is now called only a few times.
2020-02-04 14:04:11 +01:00
Ian McInerney 5053f58bfc Move 3d viewer board outline warning to the status bar
This is less intrusive than a dialog that is constantly opening
whenever the 3d view is refreshed.
2020-02-03 22:09:14 +00:00
Mario Luzeiro 970a0a593a 3d-viewer, add an option to subtract Mask from Silk
Remove holes on Silk layer by default so the behaviour is the same
on OpenGL and Raytracing.
Fixes #1836
Fix raytracing shadow offset issue.
Some codestyle fix.
2020-01-29 16:00:05 +00:00
Fabien Corona 183bbf6914 3d-viewer : synchronise colours with board stackup.
ADDED: 3d-viewer can now look up colours defined in board properties

Fixes https://gitlab.com/kicad/code/kicad/issues/2261
2020-01-22 22:38:30 +00:00
Seth Hillbrand 7c28c3838a Comment-only changes
Makes class comments conform to coding standards
2020-01-10 16:43:01 -08:00
Ian McInerney 13b6028e1b Refactor all math into a new kimath library
* Split up the thirdparty code into the thirdparty folder (#3637)
* Create a new kimath static library containing all the math functions

This is part of cleaning the build system for #1906.
2020-01-07 17:12:59 +00:00
Seth Hillbrand 84048262bd Descope KB defines
The 3d viewer is the last component to not use the action framework, so
we descope the common defines to its canvas.  Once the 3d viewer is
converted, we can remove these entirely.
2020-01-06 05:43:18 -08:00
Mark Roszko b11d52eda1 Scope 3d viewer enums
Also fix one rogue character in a gerbview file that wasn't proper UTF8.
2019-12-30 13:01:06 +00:00
Jeff Young 9d0198bade Easier control of zoom in 3D viewer.
Go to 3 steps per doubling (instead of 2), and start at 2/3 instead
of 1/2.
2019-12-28 11:58:33 +00:00
Mark Roszko 19ceb11ae7 Change more enums over to scoped enums 2019-12-28 00:55:11 +00:00
Jeff Young 8dd8740fa3 Performance enhancement for pad drawing.
Fixes: lp:1843065
* https://bugs.launchpad.net/kicad/+bug/1843065
2019-09-09 13:45:06 +01:00
Jeff Young a25368cc6b Improve spelling.
The groundwork here is thanks to kunda1.

Fixes: lp:1831510
* https://bugs.launchpad.net/kicad/+bug/1831510
2019-08-20 19:14:05 +01:00
Jeff Young baeb3689b5 Improve SNR (and spelling). 2019-08-20 18:02:28 +01:00
Seth Hillbrand 59ed9f086f 3d-viewer: Remove dead code
The 2d-bbox of the 3d viewer was calculated and set but never used
2019-08-16 10:56:32 -07:00
Simon Schubert e01348cccc 3d canvas: use radius, not width for circles 2019-08-15 14:02:00 -07:00
Jeff Young 65821f747d Bring 3D viewer in line with Pcbnew's solder mask rendering. 2019-06-25 11:34:28 +01:00
Jeff Young a3f3fb39de Convert 3DViewer to new hotkey architecture. 2019-06-10 23:46:01 +01:00
jean-pierre charras 34ccd0f004 Pcbnew: prepare the new zone filling algo (filled polygons with no thickness). Work in progress. 2019-06-04 09:39:17 +02:00
Seth Hillbrand 6a45446496 pcbnew: Remove the last dlist from modules/pcbnew 2019-06-01 20:55:32 -07:00
Seth Hillbrand 9163ac543a pcbnew: Move pads to std::deque 2019-06-01 16:23:54 -07:00
Seth Hillbrand 888c01d11b pcbnew: Move tracks to std::deque 2019-06-01 09:53:23 -07:00
Seth Hillbrand d1877d7c1b Moving modules from DLIST to std::deque 2019-06-01 09:53:23 -07:00
Jeff Young d6e9bdf07b Convert remaining legacy drawing code to print code. 2019-05-31 21:54:22 +01:00
Seth Hillbrand ac435ecd68 Moving further arc approximations down
This corrects an issue with fill segments-per-circle and moves the error
to segmetns calculation down in a number of functions to expose the
single value for approximation
2019-05-22 14:35:17 -07:00
Seth Hillbrand f347815150 3d-viewer: Fix a couple missing arc counts 2019-05-17 09:34:27 -07: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 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 1ae47b6069 Implement a copper-to-edge-clearance setting.
For legacy boards, the setting is picked up from the board outline
thickness.  If the board outline has mixed thicknesses, then the
max is used and a warning is displayed.

Fixes: lp:1797787
* https://bugs.launchpad.net/kicad/+bug/1797787
2019-04-05 22:18:44 +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
Jeff Young e71b215963 Restore 3D canvas to full size on Retina displays. 2019-02-19 16:18:11 -07:00
jean-pierre charras 4543bde56b Minor enhancements in 3D viewer hotkey code 2019-01-31 21:03:38 +01:00
Wayne Stambaugh 75f18cfe62 3D Viewer: disable ray tracing for OpenGL less than 2.1.
Add code to parse OpenGL version string and determine if ray tracing is
supported.

Rationalize ray tracing menu and toolbar to have the same behavior so
a single command ID can be used for setting states.

Fixes lp:1797500

https://bugs.launchpad.net/kicad/+bug/1797500
2019-01-19 08:03:09 -05:00
Wayne Stambaugh 4f0749b0b4 3D viewer: fix update UI event infinite loop.
Lay groundwork to fetch OpenGL version for disabling ray tracing when the
current OpenGL version lacks proper support.
2019-01-13 14:05:21 -05: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
Seth Hillbrand a46f5c3af5 3d-viewer: Clamp inner radius of rings
Thick segments can cause radius to be set negative.  Effective radius of
these segments should be 0.

Fixes: lp:1803797
* https://bugs.launchpad.net/kicad/+bug/1803797
2019-01-04 16:49:21 -08:00
Seth Hillbrand 25f8b1ce72 pcbnew: Update multiple zone segments
Where we can get away with lower segment counts (localizing an anchor),
we keep the low-def 16 segment count.  Intermediate values and values
that are visible to the user are set to high definition.  Most are
simply hints to the inflation correction but where they show, the user
show see smooth lines.
2019-01-03 17:34:59 -08:00
Seth Hillbrand 47fe01f793 3d-viewer: Remove duplicate call
Simplify is called by GetBoardPolygonOutlines(), it does not need to be
called a second time.
2018-12-09 07:52:58 -08:00
Jeff Young bcc8c64256 Consider edge cuts items to have zero width when filling zones.
Fixes: lp:1797787
* https://bugs.launchpad.net/kicad/+bug/1797787
2018-11-14 23:45:32 +00:00
jean-pierre charras 830c5e7db7 3D viewer: ensure 0 sized circles (that crash the viewer) are skipped. 2018-11-05 08:30:54 +01:00
Seth Hillbrand df562b7ec0 pcbnew: Prevent degenerate values in Eagle import
Importing Eagle files allowed for invalid zone values for clearance and
minimum width that triggered asserts in the 3d-viewer.

Fixes: lp:1801188
* https://bugs.launchpad.net/kicad/+bug/1801188
2018-11-04 11:01:08 -08:00
jean-pierre charras dbc9130da9 Fix: 3D footprint preview does not zoom using mouse wheel (Windows specific)
This was due to clicking on the preview canvas does dot give the focus to the canvas on Windows.
Now the focus is set when clicking on this canvas.

Fixes: lp:1794090
https://bugs.launchpad.net/kicad/+bug/1794090
2018-10-12 13:41:44 +02:00
Seth Hillbrand f8784f30a8 Removing OpenMP
This commit finishes the removal of OpenMP from the KiCad codebase.
Removed in this commit are the OpenMP calls in 3d-viewer and
qa/polygon_triangulation as well as all references in CMakeLists.txt

std::thread is used instead for multithreaded computation
2018-09-21 12:44:20 -07:00
Seth Hillbrand d139a49690 3d-viewer: corrected rrect zero-length radius
Previous commit mistakenly included the full clearance for the rounded
rectangle circle.  The CFILLEDCIRCLE2d takes the radius rather than the
diameter.
2018-09-20 08:52:41 -07:00
Seth Hillbrand 8efcf81cf5 3d-viewer: Approximate 0-length element is rrect
Apply same logic of using a filled circle to represent a zero-length
element as a filled circle with radius of the line.

Fixes: lp:1785823
* https://bugs.launchpad.net/kicad/+bug/1785823
2018-09-19 20:19:37 -07:00
Seth Hillbrand 8999f4604f 3d-viewer: Require simplified polygons
3d viewer requires simplified polygons not just for triangulation but
also for its own internal routines.

Fixes: lp:1793085
* https://bugs.launchpad.net/kicad/+bug/1793085
2018-09-18 09:35:30 -07:00
jean-pierre charras df5aafc481 3D viewer: Better axis rotation when selecting "Bottom view"
It allows keeping texts on bottom side readable (rotation similar to the Flip board view in board editor)
2018-09-13 09:03:58 +02:00
Seth Hillbrand c1c89d13ff 3d-viewer: Check for at least 3 segments in circle
Fixes: lp:1792173
* https://bugs.launchpad.net/kicad/+bug/1792173
2018-09-12 19:34:55 +01:00
Seth Hillbrand a6325aab29 Replacing Tesselation
Replaces Poly2Tri with updated code to process polygons faster and more
robustly.  Notably, we can now handle overlapping holes in the polygons,
allowing us to cache the triangulation of complex boards
2018-09-01 19:30:50 -07:00
jean-pierre charras 3c6e8c4a40 More support of DRW_SEGMENT Bezier curve (support in 3D viewer, and PnS router). 2018-07-22 18:39:48 +02:00
jean-pierre charras ccb668c105 3D viewer: fix polygon contours of pads solder paste when solder paste ratio was not null.
(the oval and round rect pads 3D contours were incorrect)

Fixes: lp:1767209
https://bugs.launchpad.net/kicad/+bug/1767209
2018-04-28 20:31:50 +02:00
jean-pierre charras 458f9f5c97 3D viewer: fix incorrect calculation of pad shapes with clearance (i.e. pad shapes on solder paste and solder mask layers)
Fixes: lp:1767209
https://bugs.launchpad.net/kicad/+bug/1767209
2018-04-28 12:41:43 +02:00
Jeff Young 09a6bada03 Delegation of keyEvents from 3D toolbar to 3D canvas.
Fixes: lp:1759803
* https://bugs.launchpad.net/kicad/+bug/1759803
2018-04-25 14:19:32 +01:00
jean-pierre charras 9865fcd929 3D viewer: fix hotkeys in 3D preview panel, and incorrect icons in context menu. 2018-04-17 09:59:21 +02:00
jean-pierre charras 8fcdc4f6c3 3D viewer: fixes about hotkeys and menubar.
Move code to specific files 3d_menubar.cpp and hotkeys.cpp like in other tools.
2018-04-15 14:07:33 +02:00
Seth Hillbrand 86f744a1fd Adding initialization to GLM vectors 2018-04-11 10:59:28 -07:00
Carsten Schoenert a11714b1a4 fix misspelled 'an other' -> 'another' 2018-04-08 13:24:37 -04:00
jean-pierre charras 7f6e26e55a DrawGraphicText: remove a static variable, and replace it (when needed) by a new parameter in argument list.
It make this function thread-safe (as far as wxString is thread-safe)
2018-04-07 19:57:26 +02:00
Jeff Young cd0cd242d1 Move 3D polygon approximation to absolute-error algorithm.
Also inflates via and pad hole polygons to bisect their circles.

Fixes: lp:1758137
* https://bugs.launchpad.net/kicad/+bug/1758137
2018-03-23 12:46:17 +00:00
Jeff Young b3884669cf Proper error reporting for Annotate dialog.
Also fixes:
- forcing the annotation scope to "full schematic" when run
  as a prerequisite to Generate Netlist.

- a long-standing bug where displaying extra items in a dialog
  would mess up the height of the HTML_REPORT_PANEL (becasue
  we were setting the html window's height rather than its
  parent flexgrid.

- initializing the annotation radio buttons to safe values
  (full schematic and keep existing)

Fixes: lp:1750062
* https://bugs.launchpad.net/kicad/+bug/1750062
2018-02-18 15:08:24 -05:00
jean-pierre charras 5d72aebd22 Fix code after renaming files 2018-01-29 16:40:22 +01:00
jean-pierre charras 4c5bd01887 Rename a few files 2018-01-28 22:02:31 +01:00
jean-pierre charras 5d08f1a0d9 Breaks the large create_layer_items.cpp file into 2 smaller specialized files, to make changes in 3D shapes calculations more easy. 2018-01-28 14:05:17 +01:00
Thomas Pointhuber 786ac8143e Request refresh of 3d canvas on resize event
This is a partial fix for https://bugs.launchpad.net/kicad/+bug/1695897
2018-01-05 07:25:13 -07:00
jean-pierre charras d9a2b5161c Fix issues due to internal code change in DRAWSEGMENT class, for S_POLYGON shape.
Remove also duplicate code in 3D viewer, for this DRAWSEGMENT shape.
2017-12-21 15:07:03 +01:00
Bernhard Stegmaier 0135d11412 Fix macOS pinch-to-zoom for 3d-viewer. 2017-12-18 16:26:01 +01:00
Bernhard Stegmaier 909d95b5be Create HIDPI_GL_CANVAS wrapper for transparent wxGLCanvas HiDPI/Retina support. Enable HiDPI/Retina for 3d-viewer. 2017-12-18 16:26:01 +01:00
Marvin Schmidt 69974b73db Remove some extra semicolons 2017-11-09 19:52:18 +01:00
Baranovskiy Konstantin 4612a52b50 3D Viewer: fixed entry labels in popup menu. 2017-09-29 15:31:36 +02:00
jean-pierre charras a43f3ab1fe replace "BasicShape" by "Primitive" in code, a better name 2017-09-20 12:51:10 +02:00
jean-pierre charras e2d3fcec02 Add support for custom pad shape. Full support in DRC and PnS.
add option to use shape or convex hull as clearance area in zones.
simplify code to handle clearance area
2017-09-19 09:02:53 +02:00
Tomasz Włostowski 32185ddcd3 Multiple improvements concerning colors, configuration handling and legacy features in pcbnew:
- support for background color setting
    - removed several global config settings (such as g_Drc_On)
    - wrapped most of global config settings in PCB_GENERAL_SETTINGS class
    - reorganized PCB general options dialog to clearly mark which options concern only the legacy canvas
    - new GAL feature for legacy users: double-click (or E) to change track width available as an option.

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

Fixes: lp:1707145
* https://bugs.launchpad.net/kicad/+bug/1707145
2017-08-04 16:06:57 +02:00
jean-pierre charras 6a3c1720b2 Fix a few doxygen warnings 2017-06-25 11:26:04 +02:00
Tomasz Włostowski 3b16d3cffe further DLIST/Iterators cleanup, some code formatting 2017-06-23 11:12:37 +02:00
Tomasz Włostowski 94a80acb36 DLIST_ITERATOR improvements 2017-06-23 11:12:36 +02:00
Simon Richter a9ca1e9930 Remove unreferenced local variables 2017-06-11 17:52:49 -04:00
jean-pierre charras 1fda668f24 3D viewer: cosmetic enhancements: fix an incorrect icon, and add shortcut keys in right popup menu.
Also fix an incorrect legend in hotkey list.
2017-05-26 13:28:51 +02:00
Jon Evans 3ec28e2acf Refactor layer enumerations to all live in the same place 2017-03-30 16:01:48 -04:00
jean-pierre charras 68b141dcb8 Make polygon built by BOARD::GetBoardPolygonOutlines strictly simple.
It fixes issues in 3d viewer (crashes and incorrect 3D board outline in some cases)

Fixes: lp:167484
https://bugs.launchpad.net/kicad/+bug/1674844
2017-03-23 08:56:52 +01:00
jean-pierre charras 05220a86f1 BOARD::GetBoardPolygonOutlines(): do not generate a separate SHAPE_POLY_SET for holes.
They are already managed by SHAPE_POLY_SET board outline.
2017-03-22 11:47:03 +01:00
Maciej Suminski 0dc88bb4cf Changed COLOR4D defines to static consts 2017-02-22 17:35:00 +01:00
Jon Evans a52250a91e Change from EDA_COLOR_T to COLOR4D globally; arbitrary color support
eeschema now supports arbitrary colors for all object types, and
pcbnew does in GAL canvas.  When switching from GAL to legacy canvas,
pcbnew will convert colors to the nearest legacy color.
2017-02-22 17:35:00 +01:00
John Beard a8eea6155a Move bitmaps.h out of base_struct.h
bitmaps.h was included in nearly every file in the project due to it
being included by base_struct.h

Only about 130 files actually use the XPM definitions defined there, and
many of those already included bitmaps.h themselves, or via
menu_helpers.h. However, touching bitmaps.h would result in over 400
rebuilt files for pcbnew alone.

This commit moves the bitmap-related types like BITMAT_DEF out to a new
header, which is still included by base_struct.h, which is less
avoidable for now, it's it's used in the interface.

The icon list is still in bitmaps.h. This has the side effect that's
it's now easier to automatically generate this file.

Many classes in pcbnew and eeschema needed some functions moved
to the implementaitons from the headers too.
2017-02-21 09:50:15 -05:00
Forrest Voight bce04c930d 3d-viewer: draw dimension graphics
Fixes: lp:1406754
* https://bugs.launchpad.net/kicad/+bug/1406754
2017-02-01 09:45:32 -05:00
Dick Hollenbeck 0c459ced97 EDA_TEXT object refactor.
Make all EDA_TEXT data private and rename accessors to avoid function
name collisions in derived classes.

Overload EDA_TEXT's SetTextAngle() and SetEffects() in TEXTE_PCB.

Add support for preserving Reference text position, size, orientation
during a netlist import into a BOARD, as well as the one off footprint
update dialog.
2017-01-25 08:03:32 -05:00
Baranovskiy Konstantin 3dc2050498 Improved MousewheelPAN mode. 2017-01-17 16:34:11 -05:00
Simon Wells 19512b46a3 Fix unlimited zoom with "Use touchpad to pan"
Additionally, fix an unreported bug allowing zoom level to get stuck at
MAX_ZOOM.

Fixes: lp:1625754 (3dviewer zoom not limited with Use touchpad to pan)
https://bugs.launchpad.net/kicad/+bug/1625754
2017-01-14 09:17:56 -05:00
jean-pierre charras d56a49d218 Performance counter rework: More comments, code cleaning, and move GetRunningMicroSecs() prototype from common.h to profile.h.
profile.h should now contain all info for profiling.
2017-01-02 13:49:36 +01:00
Chris Pavlina 6078ca85e5 Improve broken edge outline error message 2016-12-29 12:31:12 -05:00
Simon Richter 59c81976dc Explicitly mark overriding functions. 2016-09-24 14:53:15 -04:00
Chris Pavlina 20aca7d7bb Fix direction of ctrl+scroll in 3D viewer
Fixes: lp:1620453
* https://bugs.launchpad.net/kicad/+bug/1620453
2016-09-06 00:48:27 -04:00
jean-pierre charras 9f46d83175 Gerbview: locate item now does not take in account not visible layers. Remove an unused file
3d viewer: Remove a few ToUTF8() bad  usage (replaced by GetData() )
2016-08-19 09:45:59 +02:00
jean-pierre charras 3f1a90c8a4 3D viewer; Fix a few incorrect use of ToUTF8() in log and error messages. Only noticeable when messages contain non ASCII7 chars. 2016-08-17 09:37:51 +02:00
Mrio Luzeiro d8eab321f7 3D Viewer: complete refactor of the 3D viewer.
* Split and rewrite the preview window and canvas.
* Create a new class for handling the board information.
* Adds new render targets: openGL, legacy, and ray tracing.
* Render targets take full advantage of the new 3D plugins system and 3D cache
  for a fast 3D model loading.
* Faster board loading.
* New OpenGL render is faster than the old one.
* New ray tracing render target with a post processing shader.
* Use of new 3D plugins (WRL, X3D, STEP and IGES) and 3D model caching.
* Preview of 3D model while browsing the file name.
* 3D preview of the footprint while adding / align 3D shapes.
* Render of 3D models according to attributes: Normal, Normal+Insert, Virtual.
* Pivot rotation centered in one point over the PCB board.
* Shortcuts keys improved for XYZ orientation..
* Animated camera.
2016-07-19 13:35:25 -04:00
Mario Luzeiro 69cc788e8e + Removed glm source from kicad tree (Maciej / Cirilo)
+ Added renderer for 3D model preview (Mario)
+ Added 3d_cache including name resolver and modifications to 3D model dialogs (Cirilo)
2015-12-08 18:31:57 +11:00