Compare commits

..

1335 Commits

Author SHA1 Message Date
Wayne Stambaugh 59f308850e Tag release version 7.0.9. 2023-11-05 08:16:47 -05:00
jean-pierre charras e775a7581a pcb_calculator, MICROSTRIP::calcSynthesize(): fix incorrect init of a variable
It was initialized before other calculations, thus using a bad value.
From master branch
2023-11-01 17:31:16 +01:00
Wayne Stambaugh ec99e10b31 Tag stable version 7.0.9 release candidate 2. 2023-10-31 16:27:24 -04:00
Seth Hillbrand 240d7921ba Allow multiple strong drivers with same name
Multiple labels with the same name are allowed (and expected) so ensure
that we use a structure that allows duplicate names

(cherry picked from commit de0736863b)
2023-10-31 11:53:56 -07:00
Seth Hillbrand 9ac006b114 Don't use KiROUND when we should trunc
When calculating the viewport extents, we only need the maximum size
that can be represented.  Anything larger should be truncated.  We do
this in many other places (wx_view_controls, ruler_item,
ds_proxy_view_item, etc) and this brings pcb_selection_tool into
alignment with this, avoiding an unneeded warning message

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15529

(cherry picked from commit 6d957e9d65)
2023-10-30 09:43:45 -07:00
Seth Hillbrand c3fef1cae2 Update translations 2023-10-30 09:43:40 -07:00
Wellington Terumi Uemura ca1c99a0d1 Translated using Weblate (Portuguese (Brazil))
Currently translated at 100.0% (8023 of 8023 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/pt_BR/
2023-10-30 17:42:13 +01:00
Mert Gülsoy 06ae7a20df Translated using Weblate (Turkish)
Currently translated at 61.4% (4929 of 8023 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/tr/
2023-10-30 17:42:13 +01:00
Wellington Terumi Uemura f536ecdc00 Translated using Weblate (Portuguese (Brazil))
Currently translated at 100.0% (8023 of 8023 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/pt_BR/
2023-10-30 17:42:13 +01:00
ZbeeGin a4bdd38367 Translated using Weblate (Polish)
Currently translated at 100.0% (8023 of 8023 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/pl/
2023-10-30 17:42:13 +01:00
Arend-Jan van Hilten 6fb6d3e444 Translated using Weblate (Dutch)
Currently translated at 83.9% (6736 of 8023 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/nl/
2023-10-30 17:42:13 +01:00
Toni Laiho a3952c37bf Translated using Weblate (Finnish)
Currently translated at 99.7% (8006 of 8023 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/fi/
2023-10-30 17:42:13 +01:00
dsa-t c24ee72fe3 Translated using Weblate (Russian)
Currently translated at 99.9% (8022 of 8023 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/ru/
2023-10-30 17:42:13 +01:00
Wayne Stambaugh f988b807c4 Don't show integer overflow errors in release builds.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15529

(cherry picked from commit bfd3e71a88)
2023-10-30 10:09:35 -04:00
Alex Shvartzkop cb1a596b10 kicad manager: make extension change warning for Rename case-insensitive. 2023-10-29 22:01:50 +03:00
jean-pierre charras c41cd75b62 kicad manager: fix broken Rename file command.
From master branch.
2023-10-29 18:38:32 +01:00
Ian McInerney 0df48f3002 PCM: Fix use of variable after it was moved into the cache
(cherry picked from commit c52fb23d4f)
2023-10-29 13:40:08 +00:00
Jeff Young 2d58184080 We don't want to do collision testing against virtual vias.
(Which means they had better not have a hole.)

(cherry picked from commit f1efae1e05)
2023-10-25 18:51:14 +01:00
Jeff Young 1ef6e69d83 Don't run DRC checks against reference images.
fixes https://gitlab.com/kicad/code/kicad/-/issues/15932
2023-10-25 18:51:14 +01:00
jean-pierre charras dbd4af16c6 Gerber place files: do not quote strings (fields, pad name, pad function ...)
Double quotes have no special meaning, so adding them modify the texts
Fixes #15944
https://gitlab.com/kicad/code/kicad/-/issues/15944
2023-10-25 09:13:59 +02:00
Alex Shvartzkop 2263535d3a Add Python API compatibility for GetEffectiveTextShape. 2023-10-25 00:03:28 +03:00
Seth Hillbrand 3ce4a5bf7f Fix missing random sim command 2023-10-24 13:57:44 -07:00
Alex Shvartzkop f62c3431ff Semi-fix schematic text properties dialog on wx 3.2.3.
Based on https://gitlab.com/kicad/code/kicad/-/commit/d9b5257b9e90c53d1cba39499c76ea917344128f
2023-10-24 23:30:31 +03:00
Seth Hillbrand a652084922 Update translations 2023-10-24 12:11:15 -07:00
김랑기 ed30599db8 Translated using Weblate (Korean)
Currently translated at 99.6% (7993 of 8022 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/ko/
2023-10-24 21:09:50 +02:00
ZbeeGin d8752970e9 Translated using Weblate (Polish)
Currently translated at 100.0% (8022 of 8022 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/pl/
2023-10-24 21:09:50 +02:00
rtyuionoop 57a4c93cf5 Translated using Weblate (Vietnamese)
Currently translated at 14.8% (1189 of 8022 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/vi/
2023-10-24 21:09:50 +02:00
Tokita, Hiroshi a116f5783d Translated using Weblate (Japanese)
Currently translated at 99.9% (8021 of 8022 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/ja/
2023-10-24 21:09:50 +02:00
Jan Straka 2730098c42 Translated using Weblate (Czech)
Currently translated at 91.7% (7364 of 8022 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/cs/
2023-10-24 21:09:49 +02:00
Luc 836d17359f Translated using Weblate (German)
Currently translated at 100.0% (8022 of 8022 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/de/
2023-10-24 21:09:49 +02:00
Marine Biologist a4406bb137 Translated using Weblate (Turkish)
Currently translated at 61.4% (4928 of 8022 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/tr/
2023-10-24 21:09:49 +02:00
Wellington Terumi Uemura bbb67b415a Translated using Weblate (Portuguese (Brazil))
Currently translated at 100.0% (8022 of 8022 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/pt_BR/
2023-10-24 21:09:49 +02:00
dsa-t 0842360dbb Translated using Weblate (Russian)
Currently translated at 100.0% (8022 of 8022 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/ru/
2023-10-24 21:09:49 +02:00
Tokita, Hiroshi e58b23a54b Translated using Weblate (Japanese)
Currently translated at 99.9% (8021 of 8022 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/ja/
2023-10-24 21:09:49 +02:00
ZbeeGin 72342bd8a5 Translated using Weblate (Polish)
Currently translated at 100.0% (8022 of 8022 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/pl/
2023-10-24 21:09:49 +02:00
Wellington Terumi Uemura fa77fc3310 Translated using Weblate (Portuguese (Brazil))
Currently translated at 100.0% (8022 of 8022 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/pt_BR/
2023-10-24 21:09:49 +02:00
Alex Shvartzkop 53fe2a7203 Set UNPACK_ALIGNMENT properly for RGB bitmaps.
(cherry picked from commit 00904e8e23)
2023-10-24 06:59:53 +03:00
Alex Shvartzkop 480dfafb4f Fix variable shadowing.
(cherry picked from commit 0e4553b1fa)
2023-10-24 04:26:02 +03:00
Alex Shvartzkop f5e13c5ceb Fix up ccc29e9776 for masked images.
(cherry picked from commit 977912dcd5)
2023-10-24 04:00:30 +03:00
Alex Shvartzkop eadc902f84 Don't draw PCB bitmaps on layers not visible in high-contrast mode.
(cherry picked from commit e6cf5e5e01)
2023-10-24 03:42:54 +03:00
Alex Shvartzkop b461a3b64d OpenGL: Improve logic when bitmap cache memory is exhausted.
Don't remove the front entry, as it will likely be needed for the next bitmap.
Instead, implement neuristics based on access times.

(cherry picked from commit 71d0c7f6af)
2023-10-24 03:42:45 +03:00
Alex Shvartzkop 75c758e5f4 Improve bitmap caching performance.
(cherry picked from commit ccc29e9776)
2023-10-24 03:42:24 +03:00
Jeff Young 05912b0381 Check vias before holes as we assume any hole is non-pushable.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15840

(cherry picked from commit fb84f4592b)
2023-10-23 23:53:55 +01:00
Seth Hillbrand fb387a2c09 Don't leave deleted items in group
We filter out ref/value text in copies so we need to remove them from
the copied group (if any) as well

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15930
2023-10-23 13:34:15 -07:00
Seth Hillbrand 1380feef72 Compare bus local names
When running ERC, we want to check if bus members exist in the bus and
this should be done using m_local_name (i.e. the name it take from the
parent bus) not the resolved name as this will change depending on
connections
2023-10-23 12:54:31 -07:00
Seth Hillbrand 6c91a3022e Fix stdlib assertion
The assertion checks if an element has been added to vector.  Since we
are merely manipulating the allocated data, the number of elements does
not change and the assertion check fails.  Using the pointer to the
allocated data is a cleaner/clearer way of accomplishing this
2023-10-23 12:54:31 -07:00
Alex Shvartzkop e55989120e NanoSVG: parse 'class' attribute before 'style'.
(cherry picked from commit 64a64f5216)
2023-10-23 21:30:16 +03:00
Alex Shvartzkop 14f12ccf51 Add ngspice lib paths for when running from build dir.
(cherry picked from commit 71fb1afe4c)
2023-10-23 21:29:11 +03:00
jean-pierre charras 82a1b02b4a Plotters (especially DXF) add more precision when plotting arcs (and others)
- in DXF coordinates were using 6 digits for coordinate mantissa:
this is not enough for coord in inches. Now use 16 digits
- Arc( VECTOR2I& aCentre, EDA_ANGLE& aStartAngle, EDA_ANGLE& aEndAngle, ...)
was using integers for coord.
This creates significant errors for start point and end points of the arc.
Now the center is given in double, and its position is calculated from angle end points
(and radius) to do not generate a position error for these end points
(previously the error could be 20 ... 50 nm)
From master branch
Fixes #15056 https://gitlab.com/kicad/code/kicad/-/issues/15056
2023-10-23 17:59:31 +02:00
Jeff Young e99a2fbc56 Score initializing is done by LIB_TREE_NODE::ResetScore().
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15875

(cherry picked from commit bc0fe74f72)
2023-10-23 13:28:14 +01:00
Alex Shvartzkop d3d23d18fb Fix footprints being difficult to select in high-contrast modes.
(regression)

(cherry picked from commit 97901c9ac5)
2023-10-23 06:10:23 +03:00
Alex Shvartzkop cbf1b2af47 HPGL plotting: fix random lines connecting to circles.
(cherry picked from commit 45791ff8d6)
2023-10-22 13:56:21 +03:00
Alex Shvartzkop 4f5fca4e67 HPGL plotting: write rects as polygons to prevent always filling.
(cherry picked from commit d9c123b1ec)
2023-10-22 13:55:54 +03:00
Alex Shvartzkop e0158a8ed7 DXF plotting: write zero-sized rects and circles as points.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15862

(cherry picked from commit 3e82e59c24)
2023-10-22 13:55:54 +03:00
Alex Shvartzkop 40e7ba67d1 PDF plotting: fix zero-sized or too thick rectangles.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15862

(cherry picked from commit 843bd4f79c)
2023-10-22 13:22:42 +03:00
Wayne Stambaugh e664605c90 Fix false positive DRC footprint parity test.
This fix removed the Euclidean normalization test and replaced it with an
arc center X and Y coordinate differential check.  The error epsilon was
increased to 200nm due to the arc center position calculation code using
the near 100nm position.

https://gitlab.com/kicad/code/kicad/-/issues/15917
2023-10-21 12:37:17 -04:00
Jeff Young 5a51a6b179 Make offset-zone check multi-layer aware.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15916

(cherry picked from commit b97d8ddef4)
2023-10-21 15:09:37 +01:00
Jeff Young eb7929ccb6 Fix layer handling for create similar zone.
(cherry picked from commit f18ce8c6de)
2023-10-20 22:22:27 +01:00
Jeff Young e85eec2e6b Don't leave deleted items in a group.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15797

(cherry picked from commit 14d5a404b2)
2023-10-19 17:52:00 +01:00
Alex Shvartzkop 121394c0c0 vcpkg: Lock glm at 0.9.9.8#2
Version 2023-06-08 changed the default order of quaternion
values from xyzw to wxyz, which we don't support.

Fixes animations in the 3D viewer.

(cherry picked from commit a52ee04fc7)
2023-10-16 14:55:57 +03:00
jean-pierre charras 5ad74d58f8 pcb_calculator/transline/stripline: add missing conv from log to db.
From master branch
Fixes #15873
https://gitlab.com/kicad/code/kicad/-/issues/15873
2023-10-16 10:35:22 +02:00
Ian McInerney afe2516d57 Fix casing for gerber wildcards
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15877

(Cherry-picked from 55caa9c1e8)
2023-10-15 19:54:05 +01:00
Jeff Young ccf6e78cd5 It is legal to have nullptr zones in the m_CopperZoneRTreeCache.
(Though we might want to re-think this strategy....)

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15853
2023-10-14 22:35:06 +01:00
Jeff Young fef91fc8b9 Fix merge breakage. 2023-10-14 15:33:00 +01:00
Jeff Young 4156587abe Don't assume an error location for PAD::GetEffectivePolygon().
While ERROR_INSIDE was good for plotting, 3D generation, etc., it's
not good for generating router hulls.

Also reverts part of the change to always use polygons for PNS::SOLIDs.  A single shape in a SHAPE_COMPOUND will be faster (and
more accurate).

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14898

(cherry picked from commit 62d959ed0e)
2023-10-14 15:33:00 +01:00
Jon Evans 629eccaf09 PNS: Allow for approximation error in hull clearance
Also revert to using exact hulls for non-compound shapes

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14898

(cherry picked from commit 96f9f2c658)
2023-10-14 15:33:00 +01:00
Jeff Young f89803eb64 Don't turn an empty string into a '0'.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15871

(cherry picked from commit 0b06a1376b)
2023-10-14 15:33:00 +01:00
Jeff Young da12746a3a Clear selection before deleting board layers.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15866

(cherry picked from commit 8d3047d6eb)
2023-10-14 15:33:00 +01:00
Jeff Young b023019b0d Include solder mask in STEP export stackup height.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15632

(cherry picked from commit b4986030da)
2023-10-14 15:33:00 +01:00
Jeff Young 1fdaa1083e Honour custom layer names for Layer_Top and Layer_Bottom.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15835

(cherry picked from commit da5f5536c8)
2023-10-14 15:33:00 +01:00
Jeff Young 2f8e846b9e Adjust colours in appropriate direction depending on background.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15841

(cherry picked from commit 3f0067cbaa)
2023-10-14 15:33:00 +01:00
Alex Shvartzkop e42db52d14 Fix a crash when using length tuning tools.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15874

(cherry picked from commit 61bdee027b)
2023-10-14 16:54:16 +03:00
Alex Shvartzkop d4ec455ce0 Fix loading thru-hole pads when drill token is missing.
(cherry picked from commit f7ed9cc5c7)
2023-10-14 15:52:57 +03:00
Alex Shvartzkop 0547c7ba91 Fix loading legacy (until 2009) schematic files.
(cherry picked from commit b87496b834)
2023-10-14 15:45:20 +03:00
Alex Shvartzkop 8f4b809599 Fix the insufficient privileges message in symbol remap dialog.
(cherry picked from commit 7b94ecdc01)
2023-10-14 15:44:52 +03:00
jean-pierre charras 8432fb4fea Pcbnew: when adding layers, do not change via layers.
Via layers are not defined by a LSET, and the code that used the new LSET
broke the Via start and/or end layers (for blind/buried vias)
From master branch
Fixes #15856
https://gitlab.com/kicad/code/kicad/-/issues/15856
2023-10-14 08:56:19 +02:00
Marek Roszko 84df2c86ae Fix ambiguous cast 2023-10-13 19:26:16 -04:00
Mark Roszko 49ced23ba8 Reduce the boost dependencies in vcpkg 2023-10-13 17:03:57 +00:00
jean-pierre charras 00bf2ca36f Pcbnew: rename ZONE* m_SolderMask to m_SolderMaskBridges
(It is a container to build bridges on solder mask layers by DRC, not real zone)
Disable also this special zone selection by adding it in
PCB_SELECTION_TOOL::itemPassesFilter
Do not display the outlines of this very special zone used by DRC
to show layer mask bridges created by DRC to show these bridges.
From Master branch
Fixes #15847
https://gitlab.com/kicad/code/kicad/-/issues/15847
2023-10-13 17:15:37 +02:00
Marek Roszko b92861c7e3 Bump the wxpython in vcpkg to fix build 2023-10-13 07:51:27 -04:00
Mark Roszko a189102628 Move vcpkg forwards for curl and wx 2023-10-12 23:22:28 +00:00
jean-pierre charras 58a6eb653b protect protect RC_ITEM::SetItems() against null pointer.
Fixes #15865
https://gitlab.com/kicad/code/kicad/-/issues/15865
2023-10-12 14:56:56 +02:00
Alex Shvartzkop 9159f5a004 Restore fill polygons on proper layers when flipping zones.
(cherry picked from commit 0ea85ec9f5)
2023-10-12 02:45:05 +03:00
jean-pierre charras f1c570d793 OPENGL_GAL: ensure 0 sized rect with thickness is shown (already shown by Cairo)
From master branch
Fixes #15850
https://gitlab.com/kicad/code/kicad/-/issues/15850
2023-10-11 20:08:15 +02:00
Marek Roszko 832af39f34 Unbind ACTION_MENU events in destructor
(cherry picked from commit d801037c93)
2023-10-11 00:17:03 +00:00
Seth Hillbrand 9260f58803 Fix memory leak in connection graph
When generating virtual connections to represent bus aliases, we need to
store the pointers for future deletion otherwise we will leak the memory
2023-10-06 09:14:07 -07:00
Seth Hillbrand 1a5c515e45 Improve pin-pin iteration in ERC checks
Rather than generating expensive classes to store in a set to check for
duplicate checks, we avoid double-checking elements in the vector.  For
large schematics this results in a substantial speed increase
2023-10-06 09:14:07 -07:00
jean-pierre charras 87c8688f70 genDrillMapFile: reduce the pen width used to plot oval shapes (better look)
From master branch
2023-10-06 09:33:57 +02:00
Alex Shvartzkop d13179f9e4 EAGLE PCB: fix a regression causing polygons not being imported.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15829

(cherry picked from commit bf29b25190)
2023-10-06 01:16:43 +03:00
Seth Hillbrand 75de21314c Protect against subgraph loops
Optimize the subgraph processing to avoid repeated loops when multiple
items belong to the same subgraph.
2023-10-05 08:39:56 -07:00
Jeff Young 239f8e0905 Pull fixes back from master.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15813
2023-10-04 19:25:28 +01:00
Jeff Young f4ac624bb3 Make sure sorts are deterministic. 2023-10-04 18:52:39 +01:00
Jeff Young 2be0b98135 Make sure sort is deterministic.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15336

(cherry picked from commit 0d51729537)
2023-10-04 18:51:59 +01:00
Jeff Young 36c5719535 Fix logic screw-up in earlier commit.
(cherry picked from commit f2c0f4c87f)
2023-10-04 18:51:37 +01:00
Jeff Young 1f870bf76c Handle justification when hit-testing fields.
This steals the algo used in SCH_PAINTER to get the right coords
for the text.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15722

(cherry picked from commit 6fbbf981f0)
2023-10-04 18:51:33 +01:00
Jeff Young d5cc334e20 Clear render caches before plotting.
Also fixes a bug where text variables in LIB_TEXT weren't getting
expanded when plotting.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15765

(cherry picked from commit 003acbd686)
2023-10-04 18:49:56 +01:00
Jeff Young fd98188ee4 Use netclass values when reaching netclass entry.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15774

(cherry picked from commit 904bdc3c66)
2023-10-04 18:49:03 +01:00
Jeff Young c3446f9c2d Handle flipped state when checkging item against viewport.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15768

(cherry picked from commit 3c1478367f)
2023-10-04 18:48:42 +01:00
Marek Roszko e6e29b6c4c Unbind events in DIALOG_PCM destructor
Maybe fixes KICAD-KR


(cherry picked from commit b00871ad77)
2023-10-02 00:20:46 +00:00
Marek Roszko 6096b5c4d8 Unbind event handlers in the DIALOG_SHIM destructor to prevent late event crashes
Fixes KICAD-1XF


(cherry picked from commit 3a567a3ae1)
2023-10-01 21:55:36 +00:00
jean-pierre charras 838eadd47f Eeschema: fix a crash when loading a schematic if a symbol in a sheet has
a lib_name containing {slash} instead of /
(related to commits #2f51d22b and b2bf28f5)
From master branch.
Fixes #15791
https://gitlab.com/kicad/code/kicad/-/issues/15791
2023-10-01 10:08:33 +02:00
jean-pierre charras afb43531e8 Eeschema: fix a crash when loading a schematic if a symbol in a sheet has
a lib_id containing {slash} instead of /
(related to commit #2f51d22b)
Fixes #15791
https://gitlab.com/kicad/code/kicad/-/issues/15791
2023-09-30 18:25:18 +02:00
Jon Evans 3533e8b119 DbLib: support columns with numeric data
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15662

(cherry picked from commit 6f9af10912)
2023-09-30 10:27:34 -04:00
Jeff Young 0e6ad13db8 Fix missing part of cherry-pick. 2023-09-30 14:12:54 +01:00
Jeff Young 0d725fcc2c Fix errors in calculating tuning length.
Fix mismatched parameter passing in TOPOLOGY::followTrivialPath()
and TOPOLOGY::AssembleTrivialPath().
Fix logic error in PNS::JOINT::IsLineCorner().
Handle VVIAs in PNS::JOINT::IsNonFanoutVia().

Fixes https://gitlab.com/kicad/code/kicad/-/issues/10614

(cherry picked from commit be532e96d6)
2023-09-30 13:37:00 +01:00
Jeff Young 7e747085d3 Handle read-only libraries when saving symbol from canvas.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15519

(cherry picked from commit 1fd3f4e375)
2023-09-30 13:36:13 +01:00
Jeff Young f1376396c2 Use original event position if it's available.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15623

(cherry picked from commit e962615407)
2023-09-30 13:35:48 +01:00
Jeff Young 4eb9281f4d Tidy up shutdown of APPEARANCE_CONTROLS.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15024

(cherry picked from commit c2c71facb1)
2023-09-30 13:35:22 +01:00
Jeff Young c895816cb0 Fix arg parsing in ExecuteFile.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15326

(cherry picked from commit 0f94b467ba)
2023-09-30 13:34:26 +01:00
Jeff Young 9f814c0f6a Repair standalone application 3D plugin path resolution.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15322

(cherry picked from commit 04214983cf)
2023-09-30 13:34:09 +01:00
Jeff Young e14aef9bd5 Correct path of pcb drawing sheet file on saveAs.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15551

(cherry picked from commit 722a90213c)
2023-09-30 13:31:16 +01:00
Jeff Young 2b106a2b34 Handle flipped horiz/vert justifications in FIELDS_GRID_TABLE.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15677

(cherry picked from commit 6f62565093)
2023-09-30 13:27:28 +01:00
Jeff Young f6494d2980 Implement printing and plotting for directive-specific label shapes.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15650

(cherry picked from commit 394ab8ccb1)
2023-09-30 13:26:59 +01:00
Jeff Young 78a6c1a909 Smarten the UpdateAllItemsConditionally() tests in SetActiveLayer().
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15329

(cherry picked from commit 5842e9c57e)
2023-09-30 13:26:18 +01:00
Jeff Young c858643100 Collect comment lines into following spice unit.
This can't distinguish a header block comment in front of a file
with multiple spice units, and so will include that into the first
unit only.

Also fixes the pin assignments reference textbox to use a
fixed-width font as many .subckt's contain ASCII graphics for
pin definitions (not that it helps any with the test case from
the given bug).

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15660

(cherry picked from commit ede542f911)
2023-09-30 13:25:44 +01:00
Jeff Young 17b0bdc9fe Check value-follows-name case in symbol Save As.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15647

(cherry picked from commit 849a4656c8)
2023-09-30 13:24:32 +01:00
Jeff Young 2e0cdebb0c Do full high-contrast update of vias & pads if netnames are shown.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15657

(cherry picked from commit c7f69503c0)
2023-09-30 13:22:17 +01:00
Jeff Young a5f8955d78 Don't import Altium objects to disabled layers.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15586

(cherry picked from commit 962f79334f)
2023-09-30 13:21:16 +01:00
Jeff Young 0eca698a39 Update symbol editor's title bar when renaming the canvas symbol.
(cherry picked from commit 7d1dbb77c3)
2023-09-30 13:19:40 +01:00
Jeff Young 16f259da81 Only update value on rename if it previously matched the symbol name.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15621

(cherry picked from commit ee724f6a2b)
2023-09-30 13:18:53 +01:00
Jeff Young c3ee477a1b Apply DC voltage source exception to current sources.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15626

(cherry picked from commit 4a59f0de43)
2023-09-30 13:18:17 +01:00
Jeff Young 33da35db04 Fix typo in arguments list to EvalRules().
Also fixes a bug where we weren't clearing the previous tabs from
the notebook.

(cherry picked from commit 31e30a5f56)
2023-09-30 13:16:39 +01:00
John Beard 533be1ec70 Port EDA_SHAPE arc tests to FP_SHAPE
These tests apply only to v7, since FP_SHAPE is removed
in master. But this checks that arcs in footprints get the
same winding treatment as EDA_SHAPE arcs (using the 0-suffix
functions).
2023-09-30 12:11:50 +00:00
John Beard b64573f5d4 Add regression test for arc winding
While the bug has been fixes, the winding handling in the
SetArcGeometry() function isn't tested. This adds a regression
test on EDA_SHAPE, which is where the logic now lives.

Relates-To: https://gitlab.com/kicad/code/kicad/-/issues/15694
Cherry-Pick: fb12db5f2c
2023-09-30 12:11:50 +00:00
John Beard 1d6caa9a35 Fix winding of FP_SHAPE arcs
Implement "0" versions of some arc calculations and fix some
initialisation bugs in the handling of FP_SHAPE arcs. Also
set m_endsSwapped.

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/15694
2023-09-30 12:11:50 +00:00
Mark Roszko c74b0943f3 StartPlot can fail and leave a broken file handle
Related #15782
2023-09-29 23:54:49 +00:00
Marek Roszko bb579294a0 Don't search when board is null (during board changes)
(cherry picked from commit 98685b37ff)
2023-09-29 23:53:02 +00:00
Josue Huaroto ad9f5f4dd7 Extend boundary size of PCB_VIEW
(cherry picked from commit 156288bfcf)
2023-09-29 12:12:03 -07:00
Josue Huaroto bf2e34f32e Change variable substitution for paths in Windows.
(cherry picked from commit 74695b0995)
2023-09-29 12:10:07 -07:00
Seth Hillbrand bd57957df7 Revise method of selecting footprints in contrast
When working in high contrast mode, we want to be able to select a
footprint with only elements in, e.g. silk and fab layers.

The previous design for footprint IsOnLayer had one behavior of every
other element and a different behavior for footprints.  This leads to
multiple bugs as new features use the overloaded IsOnLayer expecting it
to report if the element exists on a layer or not.

For footprints, we need a different routine to determine whether or not
to select the footprint when clicking on it.  IsOnLayer will report if
the footprint has any elements on a specific layer but we don't want to
use the bbox for a hittest because large footprints with through hole
pads will exist on every layer and have an enormous bbox.  Instead, we
filter footprints based on the hittest of each element.  This behaves in
a more logical fashion, allowing you to select a footprint by clicking
on a visible element of that footprint.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15284

(cherry picked from commit f3d65b5156)
2023-09-29 12:09:11 -07:00
Seth Hillbrand 093db600ff Fix cherry-pick issue with file locking 2023-09-29 11:15:59 -07:00
Seth Hillbrand 131013f291 Fix Portuguese(Brasil) translation naming
On case-sensitive systems, the country code needs to be capitalized for
the language to be correctly identified between two dialects.  Since
`br` was not capitalized, we fell back on european portuguese for Linux
and MacOS

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15592

(cherry picked from commit 2be87e4527)
2023-09-29 11:10:37 -07:00
Josue Huaroto 909d199379 Save flip board status in custom preset
(cherry picked from commit 2d54bc42cb)
2023-09-29 11:07:49 -07:00
Seth Hillbrand 5f16f4ab99 Focus back to the main window after dialog
Mouse actions would focus the window but we explicitly set it here to
allow keyboard shortcuts

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15603

(cherry picked from commit b2ef620ea6)
2023-09-29 11:06:44 -07:00
Seth Hillbrand fff95fa4e6 Disable non-KiCad import for project-mode
Adds warning if project schematic contains data

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15570

(cherry picked from commit b837aa823c)
2023-09-29 11:05:49 -07:00
Seth Hillbrand a38327a39c Ensure that layer names are unique when importing
Altium allows duplicate layer names but KiCad prefers to have unique
names for each layer.  This enforces a unique name for each layer when
importing

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15583

(cherry picked from commit c772d116b2)
2023-09-29 11:03:21 -07:00
Seth Hillbrand 686048dcce Be smarter about releasing lockfiles
If KiCad crashes or exits without deleting the lockfile, don't show the
warning message unless we are not the one who locked it or there are
other KiCad instances running locally.

This should catch 99% of the cases where the message is shown
incorrectly.  There may be some corner cases where the lock file is
created on a network drive using two different machines with the same
name and same user but these cases should be (famous last words)
sufficiently rare as to not be observed in practice

(cherry picked from commit 7fe83993cf)
2023-09-29 11:02:42 -07:00
Seth Hillbrand 330c0f86de Set pinmap after updating pins
When duplicating and existing symbol, we must set the pins before
setting the lib symbol as the lib symbol will generate a pin map that
will be broken by the shift to new pins

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15728

(cherry picked from commit 12ebb2bbfa)
2023-09-29 17:59:24 +00:00
Seth Hillbrand 83317f1b80 Don't destroy the pin cache in symbols
SCH_PIN pointers are used through KiCad and removing them without a
global refresh risks crashes.  A safer approach is to simply reuse the
SCH_PIN structures, updating the data to the revised library

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15715

(cherry picked from commit bdb7b99fc8)
2023-09-29 17:59:24 +00:00
Wayne Stambaugh a416eb2cf6 Fix schematic editor crash when updating symbols.
Some how symbol names that still have escaped '/' character get mixed with
symbol names that have '/' characters now that it is no longer an invalid
LIB_ID character.  This was causing derived symbols to loose the link to
the parent symbol.  This fix replaces any instances of "{slash}" with "/"
to convert symbol names to the proper escaping.

Thanks to JP for the inspiration for the fix.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15715

Manually cherry picked from commit 2f51d22b3a.
2023-09-29 12:53:33 -04:00
Wayne Stambaugh 2959c94bd3 Begin version 7.0.9 development. 2023-09-29 12:26:05 -04:00
Wayne Stambaugh 063d9c8305 Tag release version 7.0.8. 2023-09-29 12:17:59 -04:00
Seth Hillbrand 5e97608fa5 Update translations 2023-09-29 08:58:00 -07:00
dsa-t 50dca2d02b Translated using Weblate (Russian)
Currently translated at 100.0% (8022 of 8022 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/ru/
2023-09-29 17:57:18 +02:00
Seth Hillbrand cd3785744c Update translations 2023-09-28 12:06:05 -07:00
Seth Hillbrand 357810a5d5 Revert "Translated using Weblate (Russian)"
This reverts commit 62044c2731.
2023-09-28 12:05:50 -07:00
Seth Hillbrand 1b71bc115d Revert "Translated using Weblate (Russian)"
This reverts commit 23ddb99026.
2023-09-28 12:05:50 -07:00
Seth Hillbrand de40286e81 Revert "Translated using Weblate (Russian)"
This reverts commit e7aa95d53d.
2023-09-28 12:05:49 -07:00
Seth Hillbrand 8d0ff95760 Revert "Translated using Weblate (Russian)"
This reverts commit a8bcf8c9e4.
2023-09-28 12:05:49 -07:00
Seth Hillbrand ffddf9fec3 Revert "Translated using Weblate (Russian)"
This reverts commit 3a35d96130.
2023-09-28 12:05:47 -07:00
Seth Hillbrand 3a35d96130 Translated using Weblate (Russian)
Currently translated at 100.0% (8022 of 8022 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/ru/
2023-09-28 20:59:28 +02:00
Marcel Hecko 8add678d87 Translated using Weblate (Slovak)
Currently translated at 65.1% (5223 of 8022 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/sk/
2023-09-28 20:59:28 +02:00
xXx a8bcf8c9e4 Translated using Weblate (Russian)
Currently translated at 100.0% (8022 of 8022 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/ru/
2023-09-28 20:59:28 +02:00
Hubert Hu 090374a1dc Translated using Weblate (Chinese (Simplified))
Currently translated at 99.8% (8012 of 8022 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/zh_Hans/
2023-09-28 20:59:28 +02:00
xXx e7aa95d53d Translated using Weblate (Russian)
Currently translated at 100.0% (8022 of 8022 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/ru/
2023-09-28 20:59:28 +02:00
Toni Laiho f6ccf18cf5 Translated using Weblate (Finnish)
Currently translated at 99.8% (8006 of 8022 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/fi/
2023-09-28 20:59:28 +02:00
Marine Biologist 4542ce8c70 Translated using Weblate (Turkish)
Currently translated at 61.3% (4919 of 8022 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/tr/
2023-09-28 20:59:28 +02:00
Henrik Kauhanen f80287bc27 Translated using Weblate (Swedish)
Currently translated at 99.9% (8015 of 8022 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/sv/
2023-09-28 20:59:28 +02:00
ZbeeGin e10ab74917 Translated using Weblate (Polish)
Currently translated at 100.0% (8022 of 8022 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/pl/
2023-09-28 20:59:28 +02:00
xXx 23ddb99026 Translated using Weblate (Russian)
Currently translated at 100.0% (8022 of 8022 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/ru/
2023-09-28 20:59:27 +02:00
Henrik Kauhanen efbac9e128 Translated using Weblate (Swedish)
Currently translated at 99.9% (8015 of 8022 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/sv/
2023-09-28 20:59:27 +02:00
xXx 62044c2731 Translated using Weblate (Russian)
Currently translated at 100.0% (8022 of 8022 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/ru/
2023-09-28 20:59:27 +02:00
Wellington Terumi Uemura 7d1a38d46f Translated using Weblate (Portuguese (Brazil))
Currently translated at 100.0% (8022 of 8022 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/pt_BR/
2023-09-28 20:59:27 +02:00
ZbeeGin d885bc14e1 Translated using Weblate (Polish)
Currently translated at 99.9% (8017 of 8022 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/pl/
2023-09-28 20:59:27 +02:00
Eryk Michalak 886937a3ea Translated using Weblate (Polish)
Currently translated at 99.9% (8017 of 8022 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/pl/
2023-09-28 20:59:27 +02:00
Tokita, Hiroshi 99eff43ab4 Translated using Weblate (Japanese)
Currently translated at 99.9% (8021 of 8022 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/ja/
2023-09-28 20:59:27 +02:00
Mark Hämmerling 880269780d Translated using Weblate (German)
Currently translated at 99.9% (8021 of 8022 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/de/
2023-09-28 20:59:27 +02:00
Marek Roszko 7f1b891679 Save 470KB by not re-initializing lineTypeNames over a thousand cpp files it leaks into
I saved a bunch of money on my car insurance by switching to Extern


(cherry picked from commit 9deff07ca6)
2023-09-25 02:31:46 +00:00
Wayne Stambaugh ceced2a9a4 Tag stable version 7.0.8 release candidate 1. 2023-09-20 16:53:58 -04:00
Seth Hillbrand d3a8cb84a6 Make LIB_TREE_NODE sort irreflexive
std::sort requires explicit ordering of all elements.  It does not allow
for equality in its output

(cherry picked from commit 5c1b15f8e3)
2023-09-20 13:48:43 -07:00
Seth Hillbrand 6b43bb8fe3 Fix crash in incremental update and bus conn
We store our connectivity dirty flag with the SCH_ITEM but we generate
SCH_CONNECTION based on the SCH_ITEM and the SCH_SHEET_PATH.  For this
reason, we need to avoid clearing the connectivity dirty flag until
we've finished processing all instances of the SCH_ITEM in the graph

This also means that we need to allow getting the SCH_CONNECTION pointer
even when the connectivity is still dirty (getting SCH_CONNECTION
happens based on SCH_ITEM and SCH_SHEET_PATH, not just SCH_ITEM)

(cherry picked from commit 7d12e1c4f5)
2023-09-19 16:07:40 -07:00
jean-pierre charras a74cffac39 PANEL_SETUP_BOARD_STACKUP: save the m_HasDielectricConstrains BOARD_STACKUP member.
This member was not saved in the board stackup data.
From master branch.
Fixes #15690
https://gitlab.com/kicad/code/kicad/-/issues/15690
2023-09-19 18:05:42 +02:00
Marco Ciampa 83d2891cef Updated Italian translation 2023-09-19 11:32:43 +02:00
Seth Hillbrand 0faad370f9 Fix some stale pointers in incremental updates
Shared pointers contained stale references to the temporary graph.  When
merging, we need to ensure all references are updated to the final graph

(cherry picked from commit b52c43b933)
2023-09-18 21:27:22 -07:00
Seth Hillbrand 23fab89131 Properly handle incremental bus connections
- Incremental extraction needs the newly created items.  The modified
  items are already set in the connection graph but the newly created
  items don't exist yet, so we need to add those explicitly
- Bus parents need to ensure that the bus children exist because we
  iterate on the updates from the top of the graph down

(cherry picked from commit 9fc45eb08c)
2023-09-18 21:26:58 -07:00
jean-pierre charras 48189172ea Eeschema: fix crash if using ${FOOTPRINT_NAME} or ${FOOTPRINT_LIBRARY} as values
in fields, if no footprint defined for the symbol.
From master branch
Fixes #15676
https://gitlab.com/kicad/code/kicad/-/issues/15676
2023-09-18 09:33:25 +02:00
jean-pierre charras 0c9eda44d4 French translation update 2023-09-16 10:21:41 +02:00
Seth Hillbrand f0a9ce3ab4 Update translations 2023-09-15 15:58:04 -07:00
Li Yidong ea5878a0c9 Translated using Weblate (Chinese (Traditional))
Currently translated at 99.8% (8005 of 8020 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/zh_Hant/
2023-09-16 00:57:34 +02:00
Li Yidong f67382612d Translated using Weblate (Chinese (Simplified))
Currently translated at 99.9% (8019 of 8020 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/zh_Hans/
2023-09-16 00:57:34 +02:00
Henrik Kauhanen 3fe7ae07ed Translated using Weblate (Swedish)
Currently translated at 99.9% (8016 of 8020 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/sv/
2023-09-16 00:57:34 +02:00
dsa-t 8bcfa81bea Translated using Weblate (Russian)
Currently translated at 99.9% (8019 of 8020 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/ru/
2023-09-16 00:57:34 +02:00
Jan Straka c17918d9c1 Translated using Weblate (Czech)
Currently translated at 91.8% (7363 of 8020 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/cs/
2023-09-16 00:57:34 +02:00
Ivan Chuba f752df0595 Translated using Weblate (Estonian)
Currently translated at 4.9% (400 of 8020 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/et/
2023-09-16 00:57:34 +02:00
Ivan Chuba 0836b5b661 Translated using Weblate (Ukrainian)
Currently translated at 99.9% (8017 of 8020 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/uk/
2023-09-16 00:57:34 +02:00
ZbeeGin 2cefccf7bf Translated using Weblate (Polish)
Currently translated at 99.9% (8019 of 8020 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/pl/
2023-09-16 00:57:34 +02:00
Ivan Chuba 3dc86c5a4f Translated using Weblate (Estonian)
Currently translated at 4.9% (399 of 8020 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/et/
2023-09-16 00:57:34 +02:00
ulikoehler 05ae712e77 Translated using Weblate (German)
Currently translated at 99.9% (8018 of 8020 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/de/
2023-09-16 00:57:34 +02:00
Tokita, Hiroshi 04db374326 Translated using Weblate (Japanese)
Currently translated at 99.9% (8016 of 8020 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/ja/
2023-09-16 00:57:33 +02:00
Jan Straka e3558b7dcf Translated using Weblate (Czech)
Currently translated at 91.4% (7338 of 8020 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/cs/
2023-09-16 00:57:33 +02:00
Wellington Terumi Uemura 99e10c6112 Translated using Weblate (Portuguese (Brazil))
Currently translated at 100.0% (8020 of 8020 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/pt_BR/
2023-09-16 00:57:33 +02:00
temizinsan 537934339e Translated using Weblate (Turkish)
Currently translated at 61.3% (4924 of 8020 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/tr/
2023-09-16 00:57:33 +02:00
Seth Hillbrand ee343e1263 Fix crash when duplicating symbol
Adding symbol to the screen can change the library reference.  But when
we are pasting, we want the library reference for annotation, so we need
to keep a map of old->new libsymbols and fixup the pasted symbols before
using

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15419
2023-09-15 15:43:50 -07:00
jean-pierre charras 6eeca9aa90 Pcbnew: fix some issues with very small arcs (size a few internal units)
these very small arcs do not allow to calculate a reliable center position,
and therefore a reliable radius.
So handle them as a very small segments to fix plotting/drawing issues.
From master branch.
Fixes #15639
https://gitlab.com/kicad/code/kicad/-/issues/15639
2023-09-15 17:47:21 +02:00
Alex Shvartzkop 86beb339b7 Improve error reporting when running Python action plugins.
Python error traceback is now logged to stderr.
On Windows, a console window will pop up if wxTheApp gets destroyed,
because message dialogs crash due to hooks that wxWidgets sets up.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15520

(cherry picked from commit a9a2d4aa7a)
2023-09-15 13:33:28 +03:00
Jeff Young 67b5af23aa Run filled-test before degenerate-ring-test.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15642

(cherry picked from commit 47dc86c1e2)
2023-09-13 23:45:27 +01:00
Roberto Fernandez Bautista 88f65f4e47 Fix loading of legacy zone fills in .brd files + Don't refill after board import
(cherry picked from commit 30a63b7b32)
2023-09-14 01:06:34 +03:00
Roberto Fernandez Bautista af5b6b0eba Fix import of legacy stroked zone fill + add parsing of segments fills
From master: 54f401c72c
2023-09-14 01:06:34 +03:00
Seth Hillbrand 57ef739404 Fix connectivity regression
We have a break somewhere in the connectivity that doesn't fully process
connections but the current code seems to catch these by forcing a
top-down & bottom-up calculation

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14818
2023-09-13 12:31:46 -07:00
Seth Hillbrand 584eb9f531 Remove extra nag/grid assertion
When editing the properties, if you accidentally make an extra line, you
should be able to remove the data and have it ignored.
2023-09-13 12:31:46 -07:00
Alex Shvartzkop 36a4d5a511 QA: refill zones in issue5990.kicad_pcb 2023-09-13 14:38:25 +03:00
Alex Shvartzkop 72737b20cd Fix reading legacy zone fills which were based on stroked polygons.
Ported from 448de72823
with InflateWithLinkedHoles
2023-09-13 03:40:23 +03:00
Jeff Young d05093e6f7 Don't throw the number box baby out with the bathwater.... 2023-09-12 17:39:34 +01:00
Jeff Young a7e6928f4e Don't go through a middle man when reading pad shape primitives.
They're both PCB_SHAPEs.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15073

(cherry picked from commit 9f5a268f15)
2023-09-11 22:20:33 +01:00
Alex Shvartzkop 951fd2d693 Altium schematic: support Line dash styles and colors.
Master commit: a2b7bf97b9
2023-09-11 18:33:34 +03:00
Alex Shvartzkop be991cfcd6 Clear view before resetting schematic.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15159

(cherry picked from commit cab0db76f8)
2023-09-11 18:28:05 +03:00
jean-pierre charras aab36d9b85 Gerbview, export to PCB: fix incorrect export of flashed shapes on non copper layers.
From master branch
Fixes #15613
https://gitlab.com/kicad/code/kicad/-/issues/15613
2023-09-11 15:04:55 +02:00
Alex Shvartzkop 3cd6935acb Work around wxGTK printing offset in eeschema.
Affects landscape Letter, Legal, A4 paper.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/1907

(cherry picked from commit 5da4dfd4a7)
2023-09-11 14:37:39 +03:00
Alex Shvartzkop 6daef080e3 Altium schematic: fix ISSOLID flag for text frames.
Fixed in master by 24d3df5416
2023-09-11 14:23:54 +03:00
Alex Shvartzkop 6ee909b958 Altium schematic: support custom sheet sizes.
(cherry picked from commit 16062bbe33)
2023-09-11 10:06:38 +03:00
Alex Shvartzkop c11ae8bd02 Fix a bug in RebuildBezierToSegmentsPointsList.
(cherry picked from commit 9f63820ed4)
2023-09-11 10:05:59 +03:00
John Beard c7a4ea97c3 Fix oval pad snapping
Previously the snap points computed for oval pads didn't get all the
points correct. This breaks out the "find snap points for ovals"
into a function, reworks the logic, adds some tests.

Also adds "extremum points" when the oval isn't exactly H/V.

(cherry picked from commit 78c8de9b08)

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/15594
2023-09-10 00:49:03 +01:00
John Beard 81ebb1030a Add forward declarations in pcb_grid_helper.h
(cherry pick of part of commit 0f781f328e)
2023-09-10 00:45:32 +01:00
Alex Shvartzkop 86ec36d183 Fix reading/writing thermal spoke angles for custom pads.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15518
2023-09-10 17:32:22 +03:00
jean-pierre charras 207f2e568b drc_test_provider_text_dims.cpp: ensure glyphs to test are OUTLINE_GLYPH.
For non Kicad font texts with a overbar, the overbar is not a OUTLINE_GLYPH.
From Master branch.
Fixes #15604
https://gitlab.com/kicad/code/kicad/-/issues/15604
2023-09-09 10:37:58 +02:00
Alex Shvartzkop 19753719cb SVG import: skip shapes that are not stroked and not filled.
(cherry picked from commit bc846f5fca)
2023-09-08 14:49:08 +03:00
Alex Shvartzkop 5f025dcd73 SVG import: skip invisible shapes. 2023-09-08 14:49:08 +03:00
Alex Shvartzkop c796eeaf8b NanoSVG: change preserveAspectRatio default to "xMidYMid meet".
(cherry picked from commit c64b44913c)
2023-09-08 14:49:08 +03:00
Alex Shvartzkop bdbd7f0c9c NanoSVG: update image size to the actual size after scaling.
(cherry picked from commit 2c07866fff)
2023-09-08 14:49:08 +03:00
Alex Shvartzkop b0e09327db NanoSVG: basic support for stylesheets.
Based on https://github.com/memononen/nanosvg/pull/175

(cherry picked from commit 2cd7c0636f)
2023-09-08 14:49:08 +03:00
Seth Hillbrand 96a3621b8e Update TestDanglingEnds to O(n) speed
The elements don't care which they connect to, so don't search for
points on the page, just collect them all and then test them all

Adjusts f3dd5b73

(cherry picked from commit c2fd2f42eb)
2023-09-07 01:37:42 +02:00
Josue Huaroto 8f259211e7 Change behavior of ZOOM_FIT_ALL and ZOOM_FIT_OBJECTS for PCB_EDITOR
(cherry picked from commit 91d8dabca3)
2023-09-06 16:56:27 +01:00
Josue Huaroto 0d9d8c28f1 Flip Viewport when Flip board is enabled
(cherry picked from commit a8e18e2d8c)
2023-09-06 16:56:01 +01:00
Jeff Young 058a0bbf93 Don't attempt to render degenerate 3D shapes.
Sentry KICAD-382

(cherry picked from commit 70bbaae670)
2023-09-06 16:33:31 +01:00
Jeff Young 4d46e0ceb7 Include underscore in word chars.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14779

(cherry picked from commit 0dddb27408)
2023-09-06 16:33:02 +01:00
Jeff Young 123ff326d4 Don't include plating thickness when drawing hole clearance lines.
We don't include it in the router, and the code didn't
differentiate between plated and non-plated holes, and it confuses
users.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15575

(cherry picked from commit 0cde8cff1d)
2023-09-06 16:31:46 +01:00
Jeff Young 14d4c38979 Honour override-individual-item-colors setting for filled shapes.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15572

(cherry picked from commit d593257fbd)
2023-09-06 16:31:22 +01:00
Alex Shvartzkop 9c87a52b6e Altium PCB import: Polygon Cutout only cuts copper fill.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15587

(cherry picked from commit 4f303a8dc2)
2023-09-06 09:26:48 +03:00
Alex Shvartzkop 30c2028852 Revert "Set reporter in DIALOG_SIM_MODEL::TransferDataToWindow."
This reverts commit 5b0d752e0c.
2023-09-06 08:03:00 +03:00
Marek Roszko 95e6be0e81 Prevent crash trying to load missing spice lib
(cherry picked from commit 4fe7c7a902)
2023-09-06 01:13:54 +00:00
jean-pierre charras 955313e97d GAL_OPTIONS_PANEL: replace 2 wxSpinCtrlDouble to try to fix a locale issue.
Sometimes the grid thickness setting does not work, depending on some locale setting.
Core developers are not able to reproduce this issue related to a double conversion.
So these wxSpinCtrlDouble are replaced by a wxSpinCtrl (using ints) and a wxChoice.

From master branch
2023-09-05 18:56:24 +02:00
Marek Roszko 32c2135047 Flip the RegisterSettings order to avoid legacy import crashes 2023-09-04 23:22:39 -04:00
Marek Roszko 702e08b083 Don't call .Load() and cause settings to reload from disk
RegisterSettings can load the new settings json as added by not turning off the load now parameter
2023-09-04 22:41:12 -04:00
jean-pierre charras 8f58e1a9e0 DIALOG_EXPORT_STEP_LOG: print the command line sent to kicad-cli in report window.
It can be useful in case of problems.


(cherry picked from commit 2bf8602912)
2023-09-05 00:26:43 +00:00
Mark Roszko 0cc25f10c6 Pull in ngspice 41 for vcpkg 2023-09-04 19:36:07 +00:00
Jeff Young 61ef88a0ac Don't allow duplication of footprint items outside of footprint editor.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15487

(cherry picked from commit 9bba8e5956)
2023-09-03 22:44:17 +01:00
Jeff Young 02a95b958d Remove up/down buttons until we implement layer ordering.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14574

(cherry picked from commit d27413a032)
2023-09-03 22:43:41 +01:00
Jeff Young 5cd88dbd20 Bug fixes for paste margins on custom-shaped pads.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15125

(cherry picked from commit 60419f542a)
2023-09-03 22:32:40 +01:00
Jeff Young ec53ed6a37 Don't start a router drag when already in an EDIT_TOOL drag or move.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15312

(cherry picked from commit 624203f2e1)
2023-09-03 22:12:43 +01:00
Jeff Young 242413a334 Don't start a pack&move when already in an EDIT_TOOL drag or move.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15545

(cherry picked from commit a24a8aaca7)
2023-09-03 22:12:24 +01:00
Jeff Young f88dce1627 Don't return separate shapes from a custom-shaped pad.
It just confuses the hull generator.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15553

(cherry picked from commit 43862d767e)
2023-09-03 22:11:15 +01:00
Jeff Young 5c456370d9 Add items to repeat_items after paste (or duplicate).
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15556

(cherry picked from commit f6e238dc3f)
2023-09-03 22:10:38 +01:00
Jeff Young 93fdd35b31 Support SHORT_NET_NAME(pin_number) and friends on symbols.
While it's of debatable use in the schematic, some users want to
author them there so that they're then copied onto the board.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15544

(cherry picked from commit d74e9ba040)
2023-09-03 22:07:11 +01:00
Jeff Young 70d5fccb54 {slash}-to-/ comparison special-cases need to run both ways.
(The library may be legacy format, or the document may be.)

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15540

(cherry picked from commit 86f96d544b)
2023-09-03 22:05:58 +01:00
Jeff Young 6ca7c3a3a1 Fix merge errors. 2023-09-02 11:18:34 +01:00
Jeff Young 88448ce746 Custom pads with round anchors in pre-7.0 files get 90 degree spokes.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15518

(cherry picked from commit 676c6e81a4)
2023-09-02 11:18:34 +01:00
Jeff Young 1fee2c626b Save ERC settings (including exclusions) when saving file.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15274

(cherry picked from commit 10ed1d1a7f)
2023-09-02 11:18:34 +01:00
Jeff Young 480a9ac77d Implement undo/redo around Pad Edit Mode changes.
(cherry picked from commit 69a1b30b8a)
2023-09-02 11:18:34 +01:00
Jeff Young 889689e31a Stop trying to zero-out offset of custom-shaped pads.
It causes *way* to many issues.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15555

(cherry picked from commit 68c839b214)
2023-09-02 11:18:34 +01:00
Jeff Young c8e49599ce Use STD_BITMAP_BUTTON for change symbols dialog.
(cherry picked from commit f3f57f77d9)
2023-09-02 11:18:34 +01:00
Jeff Young 351cb7e104 Re-run autoplacement after symbol replacement (when appropriate).
Also prevents an internal wxWidgets assert by clearing grid
selection before deleting rows.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15541

(cherry picked from commit 377ffb00b0)
2023-09-02 11:18:34 +01:00
Adam Simpkins 5c5e41500a kicad-cli: add option to control oval drill export behavior
Add an argument to "kicad-cli pcb export drill" to control the oval
holes drill mode for the excellon output format.

The Generate Drill Files GUI dialog recommends the newer "route"
behavior by default.  Previously this option was not exposed in
kicad-cli.  This commit does not change the default kicad-cli behavior,
but simply adds an argument to control it.


(cherry picked from commit 9b69d84688)
2023-08-31 22:26:59 +00:00
jean-pierre charras 2e739e743d Gerber place file: change DCode size of pads others than 1 or A1 to 0.1 mm
Previously it was a round shape 0.0 mm (allowed but not visible)
Gerber Format rev 2023-08 changed it to 0.1 mm (still a round shape)
2023-08-31 16:44:14 +02:00
Jeff Young 1eee3d350b Fix merge errors. 2023-08-31 12:37:44 +01:00
Jeff Young d2d7e630bd Allow for offset custom-shaped pads with no holes.
(cherry picked from commit 0d39cd5e63)
2023-08-31 12:37:44 +01:00
Jeff Young d11cd173dc Fix previous fix for honouring pad offset.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15494

(cherry picked from commit e0cf49e73c)
2023-08-31 12:37:44 +01:00
Jeff Young 12e0427038 Honour pad offset when creating custom pad anchors (and polygons).
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15494

(cherry picked from commit 300014177f)
2023-08-31 12:37:44 +01:00
Jeff Young 9bcb6f0adf Don't count pins of both De Morgan variants when matching to footprint pads.
(And remove un unused variable from grid settings dialog.)

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15550

(cherry picked from commit cb003d8ab4)
2023-08-31 12:37:44 +01:00
Jeff Young 09490e1f46 Don't snap a footprint (or group) to its children.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15535

(cherry picked from commit d161602e92)
2023-08-31 12:37:44 +01:00
Jeff Young f33120c540 Remember footprint library browsers liblist width.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15500

(cherry picked from commit a4d1b29b91)
2023-08-31 12:37:44 +01:00
Jeff Young 82ed223b02 Handle non-cardinal major-axis arcs when importing DXF.
(cherry picked from commit a946f7ab1b)
2023-08-31 12:37:44 +01:00
Jeff Young bfdbf969c2 Handle DXF arcs with a flipped coord system.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14905

(cherry picked from commit 75b160e83a)
2023-08-31 12:37:44 +01:00
Jeff Young 7d409b9404 Minor cleanup and removal of stale comments.
Also attempts to fix a focus-loss bug on GTK after zone dialog.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/13221

(cherry picked from commit 3f26b29aa2)
2023-08-31 12:37:44 +01:00
Jeff Young 7673f220a9 Minor cleanup and removal of stale comments.
(cherry picked from commit c48084bbbf)
2023-08-31 12:37:44 +01:00
Jeff Young 75daa1afec Don't presume all cached glyphs are outline glyphs.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15508

(cherry picked from commit 949458bbe1)
2023-08-31 12:37:44 +01:00
Jeff Young 27657e00fe Handle dimensions and textboxes when plotting contours to DXF.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/11901

(cherry picked from commit 83fe3576c6)
2023-08-31 12:37:44 +01:00
Mark Roszko 26b8812f15 Fix 3d viewer rendering textbox borders that were disabled 2023-08-31 02:50:36 +00:00
jean-pierre charras 07e13c51d1 UNIT_BINDER: allows more room to show values (especially inches need room)
Fixes #15539
https://gitlab.com/kicad/code/kicad/-/issues/15539
2023-08-30 09:14:28 +02:00
jean-pierre charras f9b59b4fdf PANEL_SETUP_SEVERITIES: fix a missing init (m_severitiesPage) creating a crash.
PANEL_SETUP_SEVERITIES::ImportSettingsFrom(): ensure the option to set
actually exists before setting it.
2023-08-29 10:56:40 +02:00
Seth Hillbrand 76a3b3db97 Better handle many (MANY) duplicate refs
In large designs with thousands of duplicate elements (e.g. power
symbols), we need to be smart about vector management.  Removing all but
the first few items should be batched and not element at a time

Ref: KSC-885
(cherry picked from commit b43f037a91)
2023-08-28 17:08:42 -07:00
Seth Hillbrand 4b0416e92a Simplify logic when setting field vector
Previous logic could get stuck in infinite loop if removing element from
the middle of the vector

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15498

(cherry picked from commit 9636321c09)
2023-08-28 15:29:19 -07:00
jean-pierre charras 5d6bb4b04f Update Clipper2 to commit 7cf615c2799a9328ec32eb116f46b64ed34aecff.
(it fixes (or try to fix) an issue impacting Kicad)
2023-08-28 08:02:28 +02:00
Jeff Young 2764f292cb Don't store address of temp object.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15517
2023-08-27 19:02:57 +01:00
Marek Roszko 7ca59e24c6 Force fontconfig to look at the correct path for fonts.conf on windows
(cherry picked from commit 208d146a03)
2023-08-26 17:59:47 +00:00
Marek Roszko e1a2d60672 Don't call FcInitLoadConfigAndFonts after FcInit() already happened
We are only the default global FcConfig created by calling FcInitLoadConfigAndFonts inside FcInit().
Calling FcInitLoadConfigAndFonts does nothing but creating another FcConfig option that never gets disposed or used because we use the FcConfig functions with null


(cherry picked from commit 53bf7b71c6)
2023-08-26 17:59:28 +00:00
Alex Shvartzkop 9672390104 Fix a search pane crash when a row isn't in the hit list.
Fixes KICAD-Q7
Fixes KICAD-1A6

Cherry-picked from f071dd1406
2023-08-26 00:53:14 +03:00
Alex Shvartzkop 33c2005c18 EAGLE import: fix crash when loading unknown signal class name.
Fixes KICAD-3FA

Cherry-picked from 0fcf9e2c7d and 331176744c
2023-08-26 00:47:43 +03:00
Alex Shvartzkop 3e1309110e EAGLE import: fix crash when loading a polygon.
Fixes KICAD-TW

(cherry picked from commit bfb6269f0a)
2023-08-26 00:41:50 +03:00
Wayne Stambaugh aae7d94ffd Remove duplicate references from change symbol dialog.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15480

(cherry picked from commit 1db9febcfe)
2023-08-25 14:28:13 -04:00
Alex Shvartzkop 5b0d752e0c Set reporter in DIALOG_SIM_MODEL::TransferDataToWindow.
It could've been set to point to local variable "reporter" in loadLibrary.

Fixes KICAD-15C

(cherry picked from commit 26f398a4b1)
2023-08-25 21:09:28 +03:00
jean-pierre charras 0f93752f14 Revert "Record hole knockouts in zone filler earlier"
This reverts commit 1ccaf45740.
Breaks sone thermal shapes.
Not needed after Clipper2 update.
2023-08-25 07:35:06 +02:00
jean-pierre charras 049ecc43e3 Update Clipper2 to commit 4ef91e99756f97cab23e7fa2cd78861deeb61338.
It fixes some of our issues.
However, Clipper issue 618 can create problems in zone filler, Clipper2
will be updated as soon as issue 618 is fixed.
Include also a fix for *nix
From Master branch
2023-08-25 07:35:06 +02:00
Marek Roszko 2209f5e93b Fix accidental plotting of disabled textbox borders
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15252
2023-08-24 21:14:27 -04:00
Marek Roszko a17cd9d054 Make VRML use board edge bounding box for parity with step
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15472
2023-08-24 20:42:58 -04:00
Alex Shvartzkop 4497aaa3fa Prevent crash when a python script tries to use pcbnew too early.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15414

(cherry picked from commit b1b66f66f4)
2023-08-25 00:17:03 +03:00
Jeff Young 00226ae40a Honour aAllowExtraText flag in LIB_FIELD::GetShownText().
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15470
2023-08-21 19:20:00 +01:00
jean-pierre charras 45963a3443 Step export: fix incorrect Z position of holes, after code change.
Fixes #15467
https://gitlab.com/kicad/code/kicad/-/issues/15467
2023-08-21 14:48:48 +02:00
Jeff Young 4aa1a881f3 Pull back some more fixes from master.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15461
2023-08-20 19:08:29 +01:00
Jeff Young f3dd5b73f8 TestDanglingEnds needs to test sheet pins as well.
Also fixes a bug where zooming doesn't get a redraw until mouse moves.

Also fixes a couple of bugs where dangling markers on SCH_SHEET_PINs
and SCH_HIERLABELs weren't getting drawn.

Also simplifies drawing algorithm by removing aesthetic offset (which
wasn't implemented when pin is drawn as part of selection VIEW_GROUP).

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15129

(cherry picked from commit c8e8b71198)
2023-08-20 18:44:40 +01:00
Jeff Young fd049ef510 Fix selection shadown drawing for global labels.
(The border should get shadowed, and the shape should get filled if
m_Selection.fill_shapes is set.)

(cherry picked from commit 1c13f5a0db)
2023-08-20 18:15:38 +01:00
Jeff Young 7d389f8024 Don't try to be smart about enabling the Clear Annotation button.
(At a minimum it would need to also handle when the scope changes, but
it's not clear we're adding anything by enabling/disabling it to start
with.)

(cherry picked from commit 2278f5dbca)
2023-08-19 20:09:47 +01:00
Jeff Young df63f47deb Save color settings after modification in Appearances Manager.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15390

(cherry picked from commit 1cbc6e33db)
2023-08-19 20:09:47 +01:00
Jeff Young c521efa35d Move checking for null parent higher.
(Otherwise we set the failure flag without telling the user why.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15415

(cherry picked from commit 6a6e839cc4)
2023-08-19 20:09:47 +01:00
Jeff Young af1561b848 Don't double-offset effective text shapes.
Also fixes several bugs with intersheet ref fields.  (It's possible for
other fields to have an ID of 0.)

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15165

(cherry picked from commit eedf319ba4)
2023-08-19 20:09:47 +01:00
jean-pierre charras 691931f74d kicad-cli, export plot PDF and SVG: add missing option --drill-shape-opt.
It allows pad/via holes to ber plotted at actual size, small size, or not.
This option exists in GUI, but was missing in kicad-cli.

(cherry picked from commit f18feb2a46)
2023-08-19 10:56:32 -04:00
Marek Roszko da5e1de1c8 Add a workaround to Nahimic crapware
Fixes https://gitlab.com/kicad/code/kicad/-/issues/11850


(cherry picked from commit 726f09f9ad)
2023-08-18 03:02:06 +00:00
Jeff Young 043892bdc6 Disable "Override individual item colors" on read-only themes.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15426

(cherry picked from commit 88db775d32)
2023-08-17 11:49:58 +01:00
Jeff Young 34d2aeaac3 Update Eagle gold files for spoke angle fixes.
(cherry picked from commit f2a8c25084)
2023-08-17 11:49:58 +01:00
Jeff Young 4481e89046 Fix incorrect assumption about Eagle spoke rotation.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15428

(cherry picked from commit 25b9a9de7e)
2023-08-17 11:49:58 +01:00
Jeff Young 8120e47bfd Better fidelity for Eagle thermal spokes.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15428

(cherry picked from commit a58547dde5)
2023-08-17 11:49:58 +01:00
Jeff Young db526e581c Don't call driverName() unless we have a cache miss.
(That is, in fact, the whole purpose of this cache.)

(cherry picked from commit e48a96ecaf)
2023-08-17 11:49:58 +01:00
jean-pierre charras 246be732a1 Pcbnew, DIALOG_PAD_PROPERTIES: ensure the right spoke angle is displayed.
From master, commit d8ba6c07ac
2023-08-17 08:04:18 +02:00
Marek Roszko 27a0bd2535 Backport changes to merge distance for step export
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14910
2023-08-16 22:12:55 -04:00
Jon Evans 8f57fd82a0 DbLib: Provide more useful feedback when table is misconfigured 2023-08-15 16:45:10 -04:00
Jeff Young 1ef90c898e Don't allow selection of footprint dimensions.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15418

(cherry picked from commit 750b92b17f)
2023-08-15 17:54:00 +01:00
Jeff Young cf133975c1 Avoid edge cases on very wide thermal spokes.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15280

(cherry picked from commit 1cbef0157d)
2023-08-15 17:53:35 +01:00
Jeff Young c468b68c5a Better handling of dangling markers during bus unfold.
(cherry picked from commit c981c3668a)
2023-08-15 17:52:42 +01:00
Jeff Young acbddc904b Don't consider newly-added labels when looking for terminal items.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15313

(cherry picked from commit 6cef504d2d)
2023-08-15 17:52:27 +01:00
Jeff Young 83624acfd2 Allow GetLayer() to be used with single-layer zones.
Also fixes a bug in GetFirstLayer() where we were checking
m_layerSet.size() (which is always 60) rather than
m_layerSet.count() (which is the number of set layers).

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15233

(cherry picked from commit 8bb895373a)
2023-08-15 17:51:52 +01:00
Jeff Young d915ddc647 Fix missing variable initialization.
(cherry picked from commit b401c214f5)
2023-08-15 17:30:38 +01:00
Jeff Young 61b741c34e Re-entrancy guard for length tuner tool.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15268

(cherry picked from commit 620b6b7169)
2023-08-15 17:30:02 +01:00
Jeff Young aa1910a834 Re-implement some commented-out hole clearance checking in router.
(cherry picked from commit 5e18287ff9)
2023-08-15 17:29:22 +01:00
Jeff Young dba36c07fe Only re-build the members grid when we have to.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15320

(cherry picked from commit d3329a0781)
2023-08-15 17:26:14 +01:00
Jan Mrázek 8451e6dcf1 Fix failure on multiple DRC runs via scripting
(cherry picked from commit 2d010278ad)
2023-08-15 01:40:04 +00:00
Jon Evans 88dfe6eb9c Stricter API for LIB_TABLE
Prevent nickname map or row parent getting out of sync

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15315


(cherry picked from commit 4c4bbdc8f3)
2023-08-15 01:39:09 +00:00
Wayne Stambaugh 800b697d06 Begin version 7.0.8 development. 2023-08-13 18:13:28 -04:00
Wayne Stambaugh 2176a654cd Tag release version 7.0.7. 2023-08-13 18:08:29 -04:00
Seth Hillbrand 2176788d1c Update translations 2023-08-13 14:56:51 -07:00
Milan Šalka 6389fa2d81 Translated using Weblate (Slovak)
Currently translated at 65.0% (5218 of 8022 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/sk/
2023-08-13 23:56:06 +02:00
Tokita, Hiroshi 8a0b64dd00 Translated using Weblate (Japanese)
Currently translated at 99.9% (8019 of 8022 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/ja/
2023-08-13 23:56:06 +02:00
Toni Laiho 79ac207532 Translated using Weblate (Finnish)
Currently translated at 99.8% (8010 of 8022 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/fi/
2023-08-13 23:56:06 +02:00
yangyangdaji c33e12b66f Translated using Weblate (Chinese (Simplified))
Currently translated at 100.0% (8022 of 8022 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/zh_Hans/
2023-08-13 23:56:06 +02:00
Henrik Kauhanen 5d0dfb80d4 Translated using Weblate (Swedish)
Currently translated at 99.9% (8019 of 8022 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/sv/
2023-08-13 23:56:06 +02:00
dsa-t 7ebab92f16 Translated using Weblate (Russian)
Currently translated at 100.0% (8022 of 8022 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/ru/
2023-08-13 23:56:06 +02:00
Wellington Terumi Uemura 1a851f7c33 Translated using Weblate (Portuguese (Brazil))
Currently translated at 100.0% (8022 of 8022 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/pt_BR/
2023-08-13 23:56:06 +02:00
ZbeeGin 74ee8bea5d Translated using Weblate (Polish)
Currently translated at 100.0% (8022 of 8022 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/pl/
2023-08-13 23:56:06 +02:00
Tokita, Hiroshi dec1748978 Translated using Weblate (Japanese)
Currently translated at 99.9% (8018 of 8022 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/ja/
2023-08-13 23:56:06 +02:00
Toni Laiho 4ef47e1040 Translated using Weblate (Finnish)
Currently translated at 99.8% (8010 of 8022 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/fi/
2023-08-13 23:56:05 +02:00
Henrik Kauhanen 42f242ce42 Translated using Weblate (Swedish)
Currently translated at 99.9% (8017 of 8022 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/sv/
2023-08-13 23:56:05 +02:00
jean-pierre charras c4914a64bb PCB_GRID_HELPER::BestSnapAnchor() fix overflow due to use of int.
GRID_HELPER::GetVisibleGrid() needs double, does not work with int (overflow).
Fixes #15389
https://gitlab.com/kicad/code/kicad/-/issues/15389
2023-08-11 18:04:27 +02:00
Alex Shvartzkop 4aa05dfcf2 Altium PCB importer: fix custom pad local placement. 2023-08-08 17:03:30 +03:00
Jon Evans 255ff5d789 Manual cherry-pick of 256c7fa7
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15367
2023-08-07 11:36:36 -04:00
Chris Morgan 75f5186dec vcpkg.json - Explicitly depend on sqlite3 with a range of features that...
(cherry picked from commit d03c3d0f6d)
2023-08-06 22:51:17 +00:00
Wayne Stambaugh 0cf6d80705 Stable version 7.0.7 release candidate 1. 2023-08-04 17:01:17 -04:00
Seth Hillbrand 2d96c6ad22 Better fix for #15217
Rather than rely on a quirk, we avoid the modified structure

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15217

(cherry picked from commit 248404a0d1)
2023-08-04 13:59:23 -07:00
Seth Hillbrand ef7ec13861 Fix-up for previous commit
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15217

(cherry picked from commit 018d60eb40)
2023-08-04 13:59:23 -07:00
Seth Hillbrand 8008e09918 Change stale_bus_members to work around MSVC issue
Somehow, MSVC vector gets corrupted in certain cases.  While the
mechanism is unclear, using an unordered_set avoids this problem

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15217

(cherry picked from commit 7bd3992350)
2023-08-04 13:59:23 -07:00
Alex Shvartzkop 75ace76c6a Some router/DRC performance boost (ZONE::GetZoneName) 2023-08-04 23:56:02 +03:00
Seth Hillbrand 9de58a29e3 Avoid bulking drawing sheet polygons
On the drawing sheet, the polygons are always filled and shouldn't have
additional stroking

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15242

(cherry picked from commit e71422d2cf)
2023-08-04 13:51:38 -07:00
Jon Evans 56aff41b7e Database libraries performance improvements
Rework caching system and optimize queries


(cherry picked from commit 39a5929f33)
2023-08-04 17:57:46 +00:00
Jeff Young a8417a7e23 Use pre-existing strings for 7.0. 2023-08-04 16:27:22 +01:00
Alex Shvartzkop 582c9b7f08 CompoundFileReader: fix UTF16~wstring conversion on 16b wchar compilers
(cherry picked from commit c39dfb9f05)

CompoundFileReader: fix build error

(cherry picked from commit d40e34aebe)

UTF16ToWstring: stop at NUL input terminator.

(cherry picked from commit b784b44ed0)
2023-08-04 16:50:09 +03:00
Alex Shvartzkop 2eb6ca75a8 Altium PCB import: support dashed outlines (Region kind 2)
(cherry picked from commit 430da67222)
2023-08-04 16:50:09 +03:00
Alex Shvartzkop 4918ac6307 Improvements to Altium PCB/footprint importer:
- Support unicode footprint names
- Set default footprint text size and thickness to match KLC
- Position Reference at the top, Value at the bottom of fp bounding box

(cherry picked from commit 24452f41ad)
2023-08-04 16:50:09 +03:00
Alex Shvartzkop acc03e91f3 Altium PCB: support solder/paste mask expansion rules.
- Writes expansion values to board design settings
- Imports footprint regions on Cu layers as pads
- Adds support for holes in non-Cu polygons in footprints
2023-08-04 16:50:09 +03:00
Alex Shvartzkop 8e1466a35a Altium PCB import: import holes in non-Cu polygons.
(cherry picked from commit ef66fe88ac)
2023-08-04 16:50:09 +03:00
Alex Shvartzkop 5b73af668f Altium PCB import: remove more invalid polygons.
(cherry picked from commit eb6cd4cc5d)
2023-08-04 16:50:09 +03:00
Roberto Fernandez Bautista deb035c7fe Fix loading of via drill default sizes and other settings from *.brd kicad files
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15350

(cherry picked from commit 573d2f94de)
2023-08-04 10:59:26 +02:00
Jon Evans 2075a99c9b PNS: Process holes as solids in shoveIteration
Fixes https://gitlab.com/kicad/code/kicad/-/issues/12873
2023-08-03 20:22:48 -04:00
Roberto Fernandez Bautista 74b1f603df Ensure symbols in subsheets are added to multi-unit map before re-annotating
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14918

(cherry picked from commit 6d3f512e15)
2023-08-04 01:22:26 +02:00
Jon Evans ed1eb1c018 Fix PNS debug tool 2023-08-03 18:49:37 -04:00
Jon Evans 4bed2e57cb Fix msvc being unhappy
(cherry picked from commit ca4d6e8d1d)
2023-08-03 20:16:16 +00:00
Jon Evans 0629f502b5 PNS: Improve behavior of dragging vias
- Fall back to walkaround when drag fails
- Properly check collisions with holes

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15117


(cherry picked from commit cc7d470f8b)
2023-08-03 20:16:06 +00:00
Seth Hillbrand fd93873cc1 Update translations 2023-08-03 11:30:31 -07:00
turkce dbd58dbbc6 Translated using Weblate (Turkish)
Currently translated at 61.3% (4924 of 8020 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/tr/
2023-08-03 20:23:03 +02:00
Henrik Kauhanen b2edf61588 Translated using Weblate (Swedish)
Currently translated at 99.9% (8017 of 8020 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/sv/
2023-08-03 20:23:03 +02:00
Tokita, Hiroshi 96b6975deb Translated using Weblate (Japanese)
Currently translated at 99.9% (8017 of 8020 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/ja/
2023-08-03 20:23:03 +02:00
Tokita, Hiroshi 9449dab0b7 Translated using Weblate (Japanese)
Currently translated at 99.9% (8017 of 8020 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/ja/
2023-08-03 20:23:02 +02:00
Rigo Ligo 6da9dbcc53 Translated using Weblate (Chinese (Simplified))
Currently translated at 99.9% (8012 of 8020 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/zh_Hans/
2023-08-03 20:23:02 +02:00
Tokita, Hiroshi d1bdea21b4 Translated using Weblate (Japanese)
Currently translated at 99.9% (8016 of 8020 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/ja/
2023-08-03 20:23:02 +02:00
Toni Laiho 5ea0f3253f Translated using Weblate (Finnish)
Currently translated at 99.8% (8008 of 8020 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/fi/
2023-08-03 20:23:02 +02:00
Mark Hämmerling b1e5c02e0c Translated using Weblate (German)
Currently translated at 100.0% (8020 of 8020 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/de/
2023-08-03 20:23:02 +02:00
Hubert Hu f48d97ab04 Translated using Weblate (Chinese (Simplified))
Currently translated at 99.9% (8012 of 8020 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/zh_Hans/
2023-08-03 20:23:02 +02:00
Hubert Hu 8f85e04d61 Translated using Weblate (Chinese (Simplified))
Currently translated at 99.9% (8012 of 8020 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/zh_Hans/
2023-08-03 20:23:02 +02:00
Jan Straka 1eab9b34fe Translated using Weblate (Czech)
Currently translated at 91.4% (7337 of 8020 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/cs/
2023-08-03 20:23:02 +02:00
Djamel Dellaa 13a3c44b61 Translated using Weblate (Arabic)
Currently translated at 1.2% (101 of 8020 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/ar/
2023-08-03 20:23:02 +02:00
Andrey Fedorushkov f6b106598c Translated using Weblate (Russian)
Currently translated at 99.9% (8012 of 8020 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/ru/
2023-08-03 20:23:02 +02:00
Li Yidong f6aed13605 Translated using Weblate (Chinese (Simplified))
Currently translated at 99.9% (8012 of 8020 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/zh_Hans/
2023-08-03 20:23:01 +02:00
Elias Sjögreen 62dd8e67df Translated using Weblate (Swedish)
Currently translated at 99.9% (8017 of 8020 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/sv/
2023-08-03 20:23:01 +02:00
Luc ba7620e0ee Translated using Weblate (German)
Currently translated at 99.9% (8012 of 8020 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/de/
2023-08-03 20:23:01 +02:00
Toni Laiho 931f6a35dd Translated using Weblate (Finnish)
Currently translated at 99.8% (8008 of 8020 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/fi/
2023-08-03 20:23:01 +02:00
aris-kimi d3394733b1 Translated using Weblate (Greek)
Currently translated at 99.6% (7989 of 8020 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/el/
2023-08-03 20:23:01 +02:00
turkce 0f5d175b09 Translated using Weblate (Turkish)
Currently translated at 49.6% (3982 of 8020 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/tr/
2023-08-03 20:23:01 +02:00
Henrik Kauhanen c93111bf4b Translated using Weblate (Swedish)
Currently translated at 99.9% (8016 of 8020 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/sv/
2023-08-03 20:23:01 +02:00
ZbeeGin adb0f0a46f Translated using Weblate (Polish)
Currently translated at 100.0% (8020 of 8020 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/pl/
2023-08-03 20:23:01 +02:00
Henrik Kauhanen 60454c0c39 Translated using Weblate (Finnish)
Currently translated at 99.8% (8008 of 8020 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/fi/
2023-08-03 20:23:01 +02:00
Toni Laiho de35de9e00 Translated using Weblate (Finnish)
Currently translated at 99.8% (8008 of 8020 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/fi/
2023-08-03 20:23:00 +02:00
Henrik Kauhanen d5d91ae592 Translated using Weblate (Swedish)
Currently translated at 99.9% (8016 of 8020 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/sv/
2023-08-03 20:23:00 +02:00
Ivan Chuba 9c852af5b7 Translated using Weblate (Ukrainian)
Currently translated at 99.6% (7993 of 8020 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/uk/
2023-08-03 20:23:00 +02:00
ZbeeGin 24fcfd125c Translated using Weblate (Polish)
Currently translated at 100.0% (8020 of 8020 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/pl/
2023-08-03 20:23:00 +02:00
Toni Laiho 1ad42519d6 Translated using Weblate (Finnish)
Currently translated at 99.8% (8008 of 8020 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/fi/
2023-08-03 20:23:00 +02:00
ZbeeGin 3052dcc95a Translated using Weblate (Polish)
Currently translated at 99.9% (8018 of 8020 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/pl/
2023-08-03 20:23:00 +02:00
Henrik Kauhanen 17089d8316 Translated using Weblate (Swedish)
Currently translated at 99.9% (8016 of 8020 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/sv/
2023-08-03 20:23:00 +02:00
Wellington Terumi Uemura ce919632be Translated using Weblate (Portuguese (Brazil))
Currently translated at 100.0% (8020 of 8020 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/pt_BR/
2023-08-03 20:23:00 +02:00
ZbeeGin f3168c3603 Translated using Weblate (Polish)
Currently translated at 99.9% (8015 of 8020 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/pl/
2023-08-03 20:23:00 +02:00
Toni Laiho a6ca88b5ac Translated using Weblate (Finnish)
Currently translated at 99.8% (8008 of 8020 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/fi/
2023-08-03 20:23:00 +02:00
jean-pierre charras 8625a59d4c Fix a display issue in wxStyledTextCtrl widgets in dialogs (Windows specific).
It happens when a text is using some esoteric unicode chars.
Fixes #15314
https://gitlab.com/kicad/code/kicad/-/issues/15314
2023-08-03 18:44:57 +02:00
jean-pierre charras cb4289fd19 Eeschema: fix position of shadow shape of graphic texts in a footprint.
From master branch
Fixes #15019
https://gitlab.com/kicad/code/kicad/-/issues/15019
2023-08-03 15:44:39 +02:00
Jon Evans 9ac5f837f7 Properties: disable pad y-size when circular
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15038


(cherry picked from commit 39073642a7)
2023-08-03 13:07:52 +00:00
Jon Evans 033ab9ac71 DbLib: Remove slashes from table display names
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15074


(cherry picked from commit 0e617774dd)
2023-08-03 13:07:25 +00:00
Jon Evans 228fe71eb4 Do not force focus on dataview in RC dialogs
On GTK, this causes the first item to be selected, firing the
selection handler and causing unwanted side effects.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/11925


(cherry picked from commit 7804c2177c)
2023-08-03 13:06:37 +00:00
Ian McInerney 80462cf559 Remove temp items from its group before deleting them
The 1st level items being copied don't have their group information
copied, and we assert that it has been removed from the group on
deleting it, so we just reset the group membership to prevent the
assert.

Fixes sentry KICAD-22S
(Cherry-picked from 753cc6679b)
2023-08-02 23:32:45 +01:00
Ian McInerney e5df16ba2b Pass proper parent to symbol viewer frame when changing symbols
Fixes sentry KICAD-1Z9
Fixes sentry KICAD-22J

(Cherry-picked from 1f5719ef3a)
2023-08-02 23:29:04 +01:00
Ian McInerney b0f4d56de1 Remove group association before plotting board outline in drill map
The plotter doesn't care about the grouping, and we expect the item to
have no group on deletion, so temporary items like this shouldn't be
part of one.

(Sentry issue KICAD-24Y)
(Cherry-picked from 137640ac28)
2023-08-02 23:26:35 +01:00
Ian McInerney 7bc0f8731f Remove group reference when exporting individual footprints
(Cherry-picked from d923b871d7)
2023-08-02 23:21:36 +01:00
Ian McInerney b4b49a4296 Don't skip loading the wxWidgets message catalogs
The wxWidgets message catalog contains translations for strings that are
in the wx-provided dialogs, and these strings aren't contained in our
message catalog.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15035

(Cherry-picked from 5e740c354e)
2023-08-02 23:20:21 +01:00
Ian McInerney 507054e9cd Remove temporary footprint from pcb group before deletion
Bounding box computation uses a temporary footprint, but the clone
operation keeps the group information. We can't delete a footprint if it
has group information, so just delete the group information.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14909

(Cherry-picked from b8e9544828)
2023-08-02 23:17:03 +01:00
Johannes Maibaum 342b8b157b Add KICAD_BUILD_{NIGHTLY_,}FLATPAK CMake options to 7.0 2023-08-02 22:14:25 +00:00
jean-pierre charras 74fc8f6db0 APPEARANCE_CONTROLS, preset layers: re-allow storing object visibility in
a User preset, and use the last defined object visibility when switching to
a builtin preset
From master branch
Fixes #15282
https://gitlab.com/kicad/code/kicad/-/issues/15282
2023-08-02 14:01:43 +02:00
Jon Evans 04bb3dfe9d A BOARD may not always have a project
For example, if it's the footprint editor model

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15283


(cherry picked from commit 2459949d0d)
2023-08-01 21:26:01 +00:00
jean-pierre charras 7fb15269d1 PANEL_SETUP_BOARD_STACKUP: do not try to init params managed by PANEL_SETUP_BOARD_FINISH
From master branch
Fixes #15288
https://gitlab.com/kicad/code/kicad/-/issues/15288
2023-07-29 09:59:53 +02:00
jean-pierre charras 49772d2539 Gerber export X3: fix an incorrect keyword ("route" must be "rout") 2023-07-27 20:18:16 +02:00
jean-pierre charras 0f4bd34bce Eeschema: Export symbols to New Library: Fix Cancel button not working
This bug can crash Eeschema.
Fixes #15278
https://gitlab.com/kicad/code/kicad/-/issues/15278
2023-07-27 15:16:33 +02:00
Seth Hillbrand 2451cbddec Consolidate Maximum clearance calculation
We were calculating the same thing in three locations and we missed
adding the clearance from the footprints in, resulting in bad fills and
missed drc errors (see QA addition)

(cherry picked from commit 96a34e5b57)
2023-07-26 13:16:32 -07:00
Kuba Sunderland-Ober b7363225da Ensure the bitmap exported to the clipboard is valid.
Fixes #14808
https://gitlab.com/kicad/code/kicad/-/issues/14808

(cherry picked from commit e852d04043)
2023-07-25 11:14:36 -07:00
Josue a9c0756da4 Improve calculation of min and max zoom
From master branch.
Fix: https://gitlab.com/kicad/code/kicad/-/issues/15078
2023-07-25 13:48:46 +02:00
Seth Hillbrand 2652068933 When routing, check for board-level clearances
If the board-level clearance exceeds the max pad/track clearance, we end
up missing collisions in the router.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15162

(cherry picked from commit 000998ccae)
2023-07-24 15:19:59 -07:00
Seth Hillbrand 022105cdba Fix QA for new fills in 7.0 2023-07-21 11:09:18 -07:00
Seth Hillbrand 2fa05ed245 Sort the bus alias set by name
If we place pointers in a set, they are sorted by the pointer value in
memory, not the data, so we need a custom comparator

Fixes https://gitlab.com/kicad/code/kicad/-/issues/11890

(cherry picked from commit f7f67c6d53)
2023-07-21 09:04:46 -07:00
Seth Hillbrand 124be52411 Remove check for existing hole
Does not exist now that we've refilled zones
2023-07-20 21:26:11 -07:00
Seth Hillbrand 6f8272718d Update connectivity python test
Previous test depended on which track was first.  Re-saving the board
changed the track order, so there was no pad connected.  It was still in
the connectivity database, just not at the first track

(cherry picked from commit 2485e9a38a)
2023-07-20 15:57:04 -07:00
Jeff Young bac1fb18f0 Add DRCEpsilon to net-tie-exclusion testing.
Fixes https://gitlab.com/kicad/code/kicad/issues/14008

(cherry picked from commit d9a77e6a64)

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15231
2023-07-20 12:45:38 -07:00
Seth Hillbrand 391204ea0d Update QA boards' fills 2023-07-20 12:08:24 -07:00
jean-pierre charras 810f3efcbb PANEL_PREVIEW_3D_MODEL: Always shows the footprint not flipped, and rot 0.
Otherwise, setting the 3D shapes rotation/position is not so easy.
From master branch
2023-07-20 19:05:58 +02:00
Seth Hillbrand e4a80d887a Refill legacy zone fills on open
Previous check only looked for the existence of a new (as of v6) flag
that controlled which strategy we took.  Previous versions did not write
this flag and so will not hit the check. This works around a missing
version bump from when the feature was introduced.

(cherry picked from commit 6a09cf3551)
2023-07-19 14:52:28 -07:00
Alex Shvartzkop 45d496bd01 Altium PCB: fix orientation of polygons and non-Cu pads in footprints.
Fixed in master by bbd6c80507
2023-07-20 01:14:34 +05:00
Ian McInerney 20a5b2d4c4 Don't try to enable sequential mode on non-existant files on GTK
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15222

(Cherry-picked from c26863cc1e)
2023-07-18 21:04:16 +01:00
jean-pierre charras cc2637b310 Symbol editor, DIALOG_FIELD_PROPERTIES: fix missing initialization of font.
In Symbol editor, trying to change the font of a field did nothing.
From master branch
2023-07-18 19:41:56 +02:00
Mark Roszko 3fc404cd25 Add missing imm32 lib link 2023-07-17 10:37:17 +00:00
Mark Roszko e016fa913f Backport change to block IME on the canvas itself 2023-07-17 02:07:07 +00:00
Jeff Young e1c6f4f58f Repair new switch-based Global Update Text & Graphics.
We were forgetting to handle wire and bus labels.
2023-07-16 20:24:20 +01:00
Jeff Young c50888fc79 Use loaded colours for DNP symbol.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15203

(cherry picked from commit 89e2cb0b85)
2023-07-16 20:06:41 +01:00
Jeff Young 7c0a911e9f Override FOOTPRINT::GetCenter() to ignore text.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15209

(cherry picked from commit c2e7827774)
2023-07-16 20:06:23 +01:00
Jeff Young 0562776b7a Fix logic errors in DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem().
(We can't exit out if it doesn't match a particular type as we haven't
checked the other types yet.  Use a switch to prevent this.)

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15206

(cherry picked from commit a16033f624)
2023-07-16 20:04:43 +01:00
Jeff Young 9cf79ffb5a Pick up snapped item's line properties.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15192

(cherry picked from commit 89780d353a)
2023-07-16 20:03:03 +01:00
Jeff Young 63b0ef65e0 Try both ends to see if one is a wire.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15178

(cherry picked from commit 5f8583cd25)
2023-07-16 20:02:29 +01:00
Jeff Young 62bf6a9d57 Save a bit of space in FP 3D preview by moving board thickness to dlg.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/13896

(cherry picked from commit df63ca0189)
2023-07-16 20:01:26 +01:00
Jeff Young 4ad6244d8d Don't blindly cast to PCBNEW_SETTING: we may be in CVPCB....
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15153

(cherry picked from commit 5bf257cdf6)
2023-07-16 19:45:13 +01:00
Mark Roszko b2f72020bd Add policy to alter curl revoke settings on windows 2023-07-14 00:06:42 +00:00
Marek Roszko d73f96e3d8 Add support for enum based policies
(cherry picked from commit b0fa2561b6)
2023-07-14 00:04:31 +00:00
jean-pierre charras f8210e4a2a Pcbnew, undo_redo: Do not cast to BOARD_ITEM items that are only EDA_ITEM
A BOARD_ITEM is derived from EDA_ITEM, so the cast is not possible
From Master branch
Fixes #15177
https://gitlab.com/kicad/code/kicad/-/issues/15177
2023-07-13 11:09:59 +02:00
Seth Hillbrand 1ccaf45740 Record hole knockouts in zone filler earlier
Spokes are placed across an entire pad when filling, so the hole
knockouts need to knocked out prior to deflating

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15160

(cherry picked from commit 3030c80de7)
2023-07-12 11:18:40 -07:00
jean-pierre charras d268ccea5b PCB_VIA::SetLayerSet( LSET aLayerSet ): fix bug: it must consider only copper layers.
Its purpose is to initialize the top and the bottom copper layers connected
by this via. So only copper layers in LSET must be analyzed.
From Master branch
2023-07-12 16:42:19 +02:00
jean-pierre charras 10efb6e55a PCB_TEXT::TransformTextToPolySet() fix a typo that can creates a *lot* of
segments in polygon.
Fixes #15161
https://gitlab.com/kicad/code/kicad/-/issues/15161
2023-07-11 13:12:47 +02:00
Marek Roszko 171c44507a Add env variable to turn on curl verbose 2023-07-10 21:40:50 -04:00
Alex Shvartzkop 9514f057dc Non-Windows uses libs3d_plugin prefix for S3D plugins.
https://gitlab.com/kicad/code/kicad/-/issues/12871
(cherry picked from commit e43c8fcf6b)
2023-07-10 20:18:47 +05:00
Alex Shvartzkop e154857aca Filter S3D plugins by name when running from build dir.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/12871

(cherry picked from commit 0781d8c175)
2023-07-10 20:18:47 +05:00
Alex Shvartzkop 59c06bcaf1 OpenGL GAL: fix reserved vertices calculation in drawSegmentChain.
(cherry picked from commit 6a123e2381)
2023-07-10 20:18:47 +05:00
Jeff Young 17f02b2ff0 Disable positioning tools when a move is in progress.
Also fixes a typo in EDIT_TOOL::doMoveSelection().

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15090

(cherry picked from commit 7ed5963b4f)
2023-07-09 22:01:06 +01:00
Jeff Young 6316b78a5e Add SHORT_NET_NAME processing to footprint variable resolution.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15095

(cherry picked from commit def1a9f39c)
2023-07-09 21:56:22 +01:00
Jeff Young e53269c37f Don't DisplayCurrentSheet() if we're already on it.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14305

(cherry picked from commit efac777f28)
2023-07-09 21:55:54 +01:00
Jeff Young a43adf7d4f Allow routing to a free pad (even if it has a hole).
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15093

(cherry picked from commit 6da71e5d24)
2023-07-09 21:55:21 +01:00
Jeff Young 16d24d4b43 Tailor inspector text properties for dimension objects.
(cherry picked from commit 50da4e483e)
2023-07-09 21:54:52 +01:00
Jeff Young 4a3ae82748 Don't process SCINTILLA_TRICKS onCharHook when autocomplete is active.
(ESC being the exception that proves the rule.)

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15001

(cherry picked from commit c2f2247ae3)
2023-07-09 21:54:00 +01:00
Jeff Young 60fe2ce30e Save project to disk whenever we save the board to disk.
This prevents data loss in the event of a subsequent crash.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14991

(cherry picked from commit 3bdc66d3ed)
2023-07-09 21:53:32 +01:00
Jeff Young b294530716 Prefer MRU path to LastImportExportPath for importing footprints.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15102
2023-07-09 21:39:18 +01:00
Jeff Young 0652267d00 Don't reset page unless we have to.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15033

(cherry picked from commit f892194be4)
2023-07-09 21:08:52 +01:00
Jeff Young b857374aa2 Don't consider a group to be on a copper layer.
Its members can be on copper layers, but the group itself isn't on any
layer.

Also fixes a bug where we were trying to clone TRIANGULATED_POLYGON::TRI
shapes as indexable sub-shapes.  (The TRI only has indexes into its
parent, so cloning it will only result in segfaults down the line.)

Also fixes a bug where we weren't including copper items inside groups
when checking footprint net ties.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15021

(cherry picked from commit 40abb013ec)
2023-07-09 21:08:52 +01:00
Jeff Young 480ce08d39 Clear arcs before deflating area outline.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15007

(cherry picked from commit 4473ebb02d)
2023-07-09 21:08:52 +01:00
Jeff Young 63f33a42e3 Don't trip over null strings.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14989

(cherry picked from commit ecb2fcd559)
2023-07-09 21:08:51 +01:00
Jeff Young f6d1baa50a Refine track dangling test.
Turns out Clean Up Tracks and Vias wants a different answer from DRC.

(cherry picked from commit fb40c202a1)
2023-07-09 21:08:51 +01:00
Jeff Young 0df1ec8765 Track not dangling if entirely covered by pad.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14211

(cherry picked from commit 4e3730f653)
2023-07-09 21:08:51 +01:00
Jeff Young 19e128041b Handle some Mac-standard keyboard shortcuts in Scintilla.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14973

(cherry picked from commit b3235ce667)
2023-07-09 21:08:51 +01:00
Jeff Young 76f8b3df22 Treat undo as backspace and/or escape when drawing. Ignore redo.
Undo == backspace when drawing a polygon or chained lines.  Otherwise
it's an escape.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14961

(cherry picked from commit ef6866757e)
2023-07-09 21:08:51 +01:00
jean-pierre charras e1e791fc75 *.wks files: always save text font when it is not the default font.
From Master branch
Fixes #15154
https://gitlab.com/kicad/code/kicad/-/issues/15154
2023-07-09 11:51:58 +02:00
Alex Shvartzkop bbf59a731d EAGLE PCB import: fix footprint text alignment.
(cherry picked from commit a80ac8286d)
2023-07-09 05:46:12 +05:00
Alex Shvartzkop 803bcbbea0 Altium PCB import: fix text positioning when not bottom-left aligned.
(cherry picked from commit 536744d37a)
2023-07-09 05:46:12 +05:00
Alex Shvartzkop 6f384c8802 Altium schematic: import net label justification.
(cherry picked from commit 37772ac29e)
2023-07-09 05:46:11 +05:00
Alex Shvartzkop d6eb66c738 PDF plotting: Fix "Show Page" in Foxit PDF Reader.
pageNum is an Integer. Acrobat seems to convert automatically.

(cherry picked from commit 698fffb128)
2023-07-09 05:46:11 +05:00
Alex Shvartzkop 7078381175 Eeschema printing: fix bg fill when paper orientation or size differs.
(cherry picked from commit 86458ae582)
2023-07-09 05:46:11 +05:00
Alex Shvartzkop 0ffef66cb6 Fix bitmap transparency in Cairo GAL.
Cairo ARGB32 format needs alpha pre-multiplied with color.

(cherry picked from commit f286015bc7)
2023-07-09 05:46:11 +05:00
Alex Shvartzkop dfc17244d4 Perf: don't search for niluuid items when moving cursor in eeschema.
Reduces CPU usage by 60% in some cases.

(cherry picked from commit 55b31030c0)
2023-07-09 05:46:11 +05:00
Mark Roszko ecb9f607ed Move kicad-vcpkg forward to pickup new opencascade 2023-07-08 14:18:19 +00:00
Mark Roszko 35126ba22c const bool is just bool
(cherry picked from commit e53e571d2d)
2023-07-08 01:04:30 +00:00
Simon Richter 5cdf03ff6d Do not fail formatting test when reusing a build env 2023-07-08 00:18:18 +00:00
Seth Hillbrand d128b30279 Move some DRC regression tests
The RegressionZoneFillTests handle issues that are resolved by the zone
filler, so Clipper2 problematic fill belongs there.  Otherwise, the
remaining tests should not refill the zones before running DRC because
we expect the DRC to catch errors without needing a refill

(cherry picked from commit 998e749918)
2023-07-07 12:12:13 -07:00
Seth Hillbrand cadea90109 Check for zone-zone overlap
Instead of just checking for the zone outline, we adjust to check the
full fill area of the zones for intersection and overlaps

(cherry picked from commit 954b265839)
2023-07-07 12:03:58 -07:00
Marco Ciampa 90d1695bbc Updated Italian translation 2023-07-07 10:25:11 +02:00
jean-pierre charras 713cb032b5 Fix some (minor) issues when drawing shadow texts of RULER_ITEM and pin names.
From master branch (commits 355575e4, 1698fb66 and 965aaa21)
Fixes #15019
https://gitlab.com/kicad/code/kicad/-/issues/15019
2023-07-06 19:57:49 +02:00
Marek Roszko 24ed144200 Fix EDA_TEXT creation that worked due to implicit cast
A leftover from the units object rework and I forgot to double back. The DEFAULT_SIZE_TEXT is set inside the constructor now


(cherry picked from commit b5e420c33c)
2023-07-05 13:16:10 +00:00
Simon Richter ebc584b2a7 Fix keyword order in include setup (Closes: #15081)
The SYSTEM keyword can only be used before a visibility keyword, so
"PUBLIC SYSTEM" declares an include directory named "SYSTEM".
2023-07-05 12:16:24 +00:00
Wayne Stambaugh dcef21676d Begin version 7.0.7 development. 2023-07-05 08:03:53 -04:00
Wayne Stambaugh ff2da496af Tag release version 7.0.6. 2023-07-05 08:01:08 -04:00
Steven A. Falco 9d5f85634c Allow python 3.12
(Cherry-picked from 2c983155a4)
2023-07-05 10:45:23 +01:00
Wayne Stambaugh 7efda5fbbd Tag stable release candidate 7.0.6-rc3. 2023-07-02 07:25:23 -04:00
Jeff Young 60696a895c Add DRC testing for copper graphic to zone fill collisions. 2023-06-30 11:56:40 +01:00
Seth Hillbrand 8b26f50003 SIM_VALUE stores significants in 64-bit
stol isn't neccesarily 64-bit though, so we use stoll and catch the
overflow if we have bad input data

Fixes KICAD-2EF

(cherry picked from commit 7779a01d48)
2023-06-29 10:45:29 -07:00
Fabien Corona bf78ac7a6c IBIS: model type should not be case sensitive
Fixes #15068


(cherry picked from commit 8abb701727)
2023-06-28 21:03:49 +00:00
Seth Hillbrand f9e9ed53f9 Update translations 2023-06-27 15:33:46 -07:00
Seth Hillbrand d727063036 Reset turkish translation to Mar 18 2023-06-27 15:33:27 -07:00
Jan Straka 26f69bccef Translated using Weblate (Czech)
Currently translated at 91.5% (7334 of 8014 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/cs/
2023-06-27 15:31:00 -07:00
Jan Straka 95f991b5de Translated using Weblate (Czech)
Currently translated at 91.3% (7323 of 8014 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/cs/
2023-06-27 15:30:59 -07:00
Wellington Terumi Uemura 2a4b72246b Translated using Weblate (Portuguese (Brazil))
Currently translated at 100.0% (8014 of 8014 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/pt_BR/
2023-06-27 15:30:09 -07:00
Allan Nordhøy e62c9d89b1 Translated using Weblate (Norwegian Bokmål)
Currently translated at 61.1% (4900 of 8014 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/nb_NO/
2023-06-27 15:29:42 -07:00
Seth Hillbrand 3926173dfe Fix zone fill issue with net ties
A mistake in the cherry-pick for a previous commit prevented footprint
graphics from being knocked out in the zone fill.  This sets the default
to knockout, allowing the assertion from the polygon generation routine
to catch invalid codes

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15069
2023-06-27 12:35:42 -07:00
Seth Hillbrand 9098a7c128 Add QA test to guard net ties
The QA checks that net-ties correctly knock out the zone fill underneath
them.
2023-06-27 12:27:34 -07:00
Wayne Stambaugh d77de385f0 Tag stable release candidate 7.0.6-rc2. 2023-06-26 16:05:47 -04:00
Seth Hillbrand 7bcd3e2262 Cherry-pick part of 14f6e32
This brings EDA_DRAW_FRAME::LockFile into compliance with the lockfile.h
status code.  This was part of a larger commit in the master branch but
the return code checking is needed for v7
2023-06-23 14:11:23 +02:00
Tomasz Wlostowski 2f35d97b27 router: when no collision search context is provided, assume differentNetsOnly is true
(cherry picked from commit a0a68d198c)
2023-06-23 07:55:50 -04:00
Tomasz Wlostowski 152dc56df4 router: provisional fix for 14926
(cherry picked from commit bd5954242e)
2023-06-22 12:54:22 -04:00
Seth Hillbrand 32930319ea Check for directory locking not file
When creating a new file lock, we need to check if the containing
directory can be written, not if the file (which may not yet exist) can
be written

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14942

(cherry picked from commit 6896148a10)
2023-06-21 14:53:33 +02:00
Seth Hillbrand 2e54232181 Fix LOCKFILE fallback
`throw` needs to provide an actual std::exception or it will not be
caught

(cherry picked from commit 844226e6b9)
2023-06-21 14:53:33 +02:00
Seth Hillbrand 8648017b42 Prevent ro directories from showing lockfile error
(cherry picked from commit d94fd5f979)
2023-06-21 14:53:33 +02:00
jean-pierre charras f974c8259e spice_library_parser: catch an exception thrown when a spice model cannot be built.
Fixes #15012
https://gitlab.com/kicad/code/kicad/-/issues/15012
2023-06-20 10:34:50 +02:00
jean-pierre charras f6f99e45b9 Pcbnew, graphic importer: convert arc with large radius to segment.
Arcs having a too large radius cannot be safely handled.
The criteria (not perfect) is radius < INT_MAX/2 to use arcs
Fixes #14210
https://gitlab.com/kicad/code/kicad/-/issues/14210
2023-06-19 10:46:30 +02:00
Seth Hillbrand 414fca0664 Update Translations 2023-06-18 15:39:30 +02:00
turkce 2641a0d98e Translated using Weblate (Turkish)
Currently translated at 71.9% (5764 of 8014 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/tr/
2023-06-18 15:37:56 +02:00
Henrik Kauhanen 53e8d68878 Translated using Weblate (Swedish)
Currently translated at 99.9% (8010 of 8014 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/sv/
2023-06-18 15:37:56 +02:00
ZbeeGin 7a6d0c3432 Translated using Weblate (Polish)
Currently translated at 100.0% (8014 of 8014 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/pl/
2023-06-18 15:37:56 +02:00
Toni Laiho b049902925 Translated using Weblate (Finnish)
Currently translated at 99.8% (8002 of 8014 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/fi/
2023-06-18 15:37:55 +02:00
turkce a8289c3223 Translated using Weblate (Turkish)
Currently translated at 57.9% (4647 of 8014 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/tr/
2023-06-18 15:37:55 +02:00
Julian Daube e46d742d6c Translated using Weblate (German)
Currently translated at 99.6% (7986 of 8014 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/de/
2023-06-18 15:37:55 +02:00
Jan Straka 24d996c8c4 Translated using Weblate (Czech)
Currently translated at 91.3% (7322 of 8014 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/cs/
2023-06-18 15:37:55 +02:00
Tokita, Hiroshi 8b2cdc434b Translated using Weblate (Japanese)
Currently translated at 99.9% (8010 of 8014 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/ja/
2023-06-18 15:37:55 +02:00
ZbeeGin a7c4f15fea Translated using Weblate (Polish)
Currently translated at 100.0% (8014 of 8014 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/pl/
2023-06-18 15:37:55 +02:00
김랑기 05b0cc9e76 Translated using Weblate (Korean)
Currently translated at 99.8% (8001 of 8014 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/ko/
2023-06-18 15:37:55 +02:00
Hubert Hu 495aaa4c56 Translated using Weblate (Chinese (Simplified))
Currently translated at 100.0% (8014 of 8014 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/zh_Hans/
2023-06-18 15:37:55 +02:00
Bas Wijnen b57ba269a6 Translated using Weblate (Dutch)
Currently translated at 84.1% (6742 of 8014 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/nl/
2023-06-18 15:37:54 +02:00
ZbeeGin 4948eb0d45 Translated using Weblate (Polish)
Currently translated at 99.8% (8000 of 8014 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/pl/
2023-06-18 15:37:54 +02:00
Bas Wijnen e5e6b9e820 Translated using Weblate (Dutch)
Currently translated at 83.8% (6721 of 8014 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/nl/
2023-06-18 15:37:54 +02:00
Tokita, Hiroshi 1c2b236c86 Translated using Weblate (Japanese)
Currently translated at 99.9% (8007 of 8014 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/ja/
2023-06-18 15:37:54 +02:00
Toni Laiho 6ca66a04da Translated using Weblate (Finnish)
Currently translated at 99.8% (8002 of 8014 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/fi/
2023-06-18 15:37:54 +02:00
Karl SCHUH 2595be63a1 Translated using Weblate (German)
Currently translated at 99.6% (7984 of 8014 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/de/
2023-06-18 15:37:54 +02:00
Hubert Hu c31b36975d Translated using Weblate (Chinese (Simplified))
Currently translated at 100.0% (8014 of 8014 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/zh_Hans/
2023-06-18 15:37:54 +02:00
Hubert Hu 73a2fcd301 Translated using Weblate (Chinese (Simplified))
Currently translated at 99.9% (8012 of 8014 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/zh_Hans/
2023-06-18 15:37:54 +02:00
Wellington Terumi Uemura 00b0a7c811 Translated using Weblate (Portuguese (Brazil))
Currently translated at 100.0% (8014 of 8014 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/pt_BR/
2023-06-18 15:37:53 +02:00
Jan Straka 2ef93cad44 Translated using Weblate (Czech)
Currently translated at 91.1% (7306 of 8014 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/cs/
2023-06-18 15:37:53 +02:00
Seth Hillbrand d3aa304556 Fix MSW and OSX kiplatform io libs
Takes fixes from master branch.  Includes ff072feeb4
2023-06-18 15:35:21 +02:00
Wayne Stambaugh 228927b4e9 Tag stable release candidate 7.0.6-rc1. 2023-06-17 19:33:44 -04:00
Seth Hillbrand 6fc393c7db Upgrade file locking
wxSingleInstanceChecker is meant for running programs, not file locking.
This implements an RAII class for file locking that stores the lock
files next to the file being locked, allowing it to be easily found and
removed.  Also includes the ability to override the lock, with
information about the original owner

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14734

(cherry picked from commit 122be418bb)
2023-06-18 01:06:40 +02:00
Seth Hillbrand 361fdcce1b Maintain file permissions when renaming
Temporary and autosave files do not neccessarily have the correct
permissions set to replace existing project files.  This updates the
permissions to match the existing values where possible

Fixes https://gitlab.com/kicad/code/kicad/-/issues/13574

(cherry picked from commit 48ecd742eb)
2023-06-18 01:06:14 +02:00
Jeff Young 12cf696097 Tab-order fix provided by aris-kimi.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/9406
2023-06-17 18:34:52 +01:00
Jeff Young e7ae6cd190 Recompute intersheet refs while printing.
Also fixes a bug where the schematic offset wasn't being added to
intersheet refs when printing.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14978

(cherry picked from commit e3eb0abc5f)
2023-06-17 18:12:44 +01:00
Jeff Young 61dfe4ef07 Don't leave selection lying around when swapping out footprints.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14971

(cherry picked from commit da558f57d4)
2023-06-17 17:30:24 +01:00
Jeff Young d3099ecf75 Don't create 22.5-degree gateways if we're not cardinal or diagonal.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14984
2023-06-17 16:05:07 +01:00
Jeff Young c183e3f342 Cleanup. 2023-06-17 16:04:56 +01:00
Alex Shvartzkop a5ded3341a Adapt panels to PAGED_DIALOG sizing algorithm.
Also some cosmetic fixes (GTK).

(cherry picked from commit d3be62f644)
2023-06-17 15:19:26 +03:00
Alex Shvartzkop bb15c56a2d PAGED_DIALOG: make sure the dialog is big enough to contain page.
(cherry picked from commit 6ace80700e)
2023-06-17 15:19:26 +03:00
Alex Shvartzkop c61931996a PAGED_DIALOG: allow setting initial size in ctor.
(cherry picked from commit f5da58e17d)
2023-06-17 15:19:26 +03:00
Alex cb6c91be06 Center calculator grid cells, sync font styles with fbp.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14743

(cherry picked from commit d945b76c65)
2023-06-17 15:19:26 +03:00
Alex bfcdec47c1 Move bitmap setup to ctor in eeschema annotation options.
(cherry picked from commit 26c25c5475)
2023-06-17 15:19:25 +03:00
Jeff Young c0445ed857 Reset session drawing props after Board Setup.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14932

(cherry picked from commit 9ed2458f00)
2023-06-17 13:04:48 +01:00
Wayne Stambaugh 4e79d1ecdd Command line PCB gerber export fix and improvement.
The --board-plot-params argument was never parsed so it was always ignored.

[ADDED] A '--no-protel-ext' option to allow plotting gerbers with the KiCad
        file extension (gbr) instead of the Protel gerber file extensions.
2023-06-16 07:14:37 -04:00
jean-pierre charras 4306af3ef3 Plot Solder mask layer: do not add items on edge_cut, but not on mask layer
it happened only when creating a solder mask plot with a minimum thickness.
This was a legacy option, incorrect now.
Fixes #14960
https://gitlab.com/kicad/code/kicad/-/issues/14960
2023-06-16 10:01:29 +02:00
Jeff Young a01f9f99f4 More protection around an exceedingly dangerous hack.
The API is needed for wxFormBuilder, and I couldn't figure out any
way around it, but we can at least reduce the risk of someone calling
it accidentally (again).

(cherry picked from commit 46564055f4)
2023-06-14 13:57:27 +01:00
Alex Shvartzkop 08186f4131 Fix lock condition in GL_CONTEXT_MANAGER, remove unnecessary assert.
Assert handler is already being called from wxCHECK.


(cherry picked from commit dfb05c4f4b)
2023-06-14 04:46:06 +00:00
jean-pierre charras bdc9807dee Pcbnew: fix crash when selecting a footprint due to a not initialized pointer 2023-06-13 11:37:12 +02:00
Marco Ciampa d77180d9b5 Small fix in Italian translation 2023-06-12 14:32:55 +02:00
Jeff Young b0bcaa971e BoardDesignSettings are owned by FOOTPRINT_EDITOR_SETTINGS in the FP Editor.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14925
2023-06-12 10:08:09 +01:00
jean-pierre charras 4294202074 gr_basic.cpp: ensure a pen with width = 0 is transparent.
Setting its color to COLOR4D::UNSPECIFIED (i.e. opacity = 0) is not enough
for all  platforms (i.e. Windows)
From master branch
Fixes #14915
https://gitlab.com/kicad/code/kicad/-/issues/14915
2023-06-12 08:45:01 +02:00
Jeff Young 1e013274c2 Fix broken build. 2023-06-11 22:35:54 +01:00
Jeff Young 39c7024f12 Make sure infobar gets created earlier.
(restoreLastFootprint() might want it.)

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14922

(cherry picked from commit 3159391e28)
2023-06-11 22:32:05 +01:00
Jeff Young 375f3a7164 Remove double call to Destroy() for DISPLAY_FOOTPRINTS_FRAME.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14928

(cherry picked from commit bae8a077b9)
2023-06-11 22:31:27 +01:00
Jeff Young 370bdef8d0 Clear the playerFrame lookup cache when closing frames.
WindowIds aren't actually guaranteed to be unique, and we don't
perform a dynamic_cast on the result of FindWindowById() because
of linker issues....

This is an attempt to fix KICAD-39.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14928

(cherry picked from commit d6aefc458c)
2023-06-11 22:31:24 +01:00
Jeff Young 7b1e75e6ed Don't accidentally add NULL ptrs to the LibSymbols cache.
Operator[] will add a blank element if it isn't found in the map.

Probably Sentry KICAD-23Y.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14927

(cherry picked from commit 96073402ce)
2023-06-11 22:31:18 +01:00
Jeff Young 5c1a089981 Re-create missing exclusion markers if DRC was cancelled.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14919

(cherry picked from commit 93789e75b9)
2023-06-11 22:31:13 +01:00
Jeff Young cfb59094fe Make sure infobar gets created earlier.
restoreLastFootprint() might want it.

(cherry picked from commit 4fc6047f91)
2023-06-11 22:30:43 +01:00
Jeff Young 7d30a2bc54 Make FOOTPRINT_PREVIEW_PANEL a FPHOLDER.
Also makes sure it get its user_units set up.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14913

(cherry picked from commit d18b0c62f6)
2023-06-11 22:30:16 +01:00
Jeff Young 472879e95a Check for proxy references and values in Selectable().
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14911

(cherry picked from commit 111d0a2c14)
2023-06-11 22:07:26 +01:00
CraftedNightmare 7027d02f94 Fix Search pane not remembering docking sizes and positions
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14120


(cherry picked from commit d94e9b31b1)
2023-06-11 20:24:41 +00:00
Salvador E. Tropea 561441b48a Adds the missing plot formats to kicad-cli sch export 2023-06-11 13:56:24 -04:00
Jon Evans fe5c7a60ab Net Inspector: clear sort ordering during rebuild
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14697


(cherry picked from commit 3a2cc8f56f)
2023-06-11 17:16:57 +00:00
Alex Shvartzkop 1a3dc72af8 Avoid deadlock when OpenGL context can't be created.
Previously, with aContext == nullptr, the mutex would lock, but not unlock.
Then it got deadlocked inside OPENGL_GAL dtor.

(cherry picked from commit eaf65f7d53)
2023-06-11 20:12:22 +03:00
Nils VAN ZUIJLEN c919694f37 cli: add an option to the pcb exports for plotting negative svg and pdf
ADDED: The -n or --negative option for exporting negative svg or pdf plots
from kicad-cli. Example usage: kicad-cli pcb export svg -n -l B.Cu board.kicad_pcb
2023-06-10 14:50:27 -04:00
Jeff Young 6fbdf8f0e2 Handle Altium dimension angles and non-unit suffixes.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/13751

(cherry picked from commit 97cf7c874e)
2023-06-10 10:57:14 +01:00
Jeff Young 4060ec3038 Treat canvas item as current when tree view contains no selection.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/12702

(cherry picked from commit 1528f4700c)
2023-06-10 10:57:14 +01:00
Jeff Young 32626970a0 Prevent Sentry KICAD-MM crash.
It'd be nicer to know what happens, but we don't have a reproducible
case, so this "fix" will at least prevent that particular crash.

(cherry picked from commit 0091b9f897)
2023-06-10 10:57:14 +01:00
Jeff Young bc0a53a226 Increased mutex safety.
Don't even query the size() without having at least a shared_lock.

*May* prevent KICAD-4S, but seems unlikely.

(cherry picked from commit f3d3ade1dc)
2023-06-10 10:57:14 +01:00
Jeff Young b6a044111b Exclude redraws during closing (particularly of RATSNEST_VIEW_ITEM).
(cherry picked from commit 7a3a8b67c1)
2023-06-10 10:57:14 +01:00
Jeff Young 3c4286c98b Force re-word-wrapping of PCM package descriptions on Mac.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/13328

(cherry picked from commit c7730eae3f)
2023-06-10 10:57:14 +01:00
Jeff Young 6d996e31b8 Don't dim SCH_FIELDs when selecting them.
(They were only getting drawn on top of the selection shadow when
drawn by their parent symbol because LIB_FIELD was correctly
setting the view layers but SCH_FIELD was not.)

(cherry picked from commit 2300b0d2a3)
2023-06-10 10:57:14 +01:00
Jeff Young ec4faad589 Don't allow setting a pad width or height of 0.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14278

(cherry picked from commit ddd2cb005b)
2023-06-10 10:57:14 +01:00
Alex 13820bc002 Support --mirror option in "kicad-cli pcb export pdf"
(cherry picked from commit 2450435131)
2023-06-10 04:58:07 +03:00
Alex 6ad9f25e7d Enable support for KICAD_SANITIZE_ADDRESS CMake flag on MSVC.
(cherry picked from commit d5edde799c)
2023-06-09 23:10:44 +00:00
Jeff Young a348fde7d1 Assertion checking for hole/parent ownership mismatch.
(This mismatch is the root of the problem in issue #14852.)
2023-06-10 01:05:00 +02:00
Tomasz Włostowski d25017dd5b router: can't add a clone of a VIA's hole when adding the via to INDEX - this will result in bogus colliding objects
This commit partially reverts deb3cbf8. VIA and SOLID operator='s introduced in it do a good job but the cloning of holes in addHole() causes bogus collisions.
2023-06-10 01:04:49 +02:00
Jeff Young 9b965f367a Prevent use-after-free crashes by not fighting over who owns a HOLE.
The diff-pair placer creates DIFF_PAIRs on the stack, which have
VIAs in them, which have HOLEs in them.  The HOLEs get put in the
NODE's index, and we then crash later when doing a collision after
the stack variable has gone out of scope.

The stack variable is also copied while doing a search for "best",
and without the operator= definitions the "best" and the "original"
both think they own the HOLE.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14852
2023-06-10 01:04:37 +02:00
Tomasz Wlostowski adca34ac6a router: invalidate items freed by PNS::NODE in the clearance cache
This was causing intermittent shove hiccups/freezes as RULE_RESOLVER::GetClearance() could return a bogus clearance value, taking
a cached value for an item that does not exist anymore. If the allocator/stack accidentally reclaimed such item's address - we were getting
very nasty and difficult to reproduce misbehaviours of the shove algorithm. Hopefully this patch fixes this. More info in the comments.

Note to self - I'm still not fully convinced I want PNS::ITEM pointers as the cache key, probably a unique counter would be better here.
2023-06-10 01:04:25 +02:00
Tomasz Wlostowski 51a4a92ec4 router: fix use-after-free crash in drag walkaround mode 2023-06-10 01:04:13 +02:00
Tomasz Wlostowski ae8ea3b938 router: correctly assign owner via/pad to its hole when committing the world state
fixes #14852
2023-06-10 00:27:38 +02:00
jean-pierre charras b57d77dd0b kicad-cli, STEP export: fix incorrect unit when user origin is specifed.
They are specified in mm (or inches), but must be stored in board units in code.
From master branch
2023-06-09 13:43:12 +02:00
Seth Hillbrand d5cbb56160 Fix builds for non-MSW 2023-06-07 08:26:27 -07:00
Seth Hillbrand e97c2a6864 Update Clipper2 to 9d946d7
Fixed a number of smaller issues as well as overlapping segment
cleaning.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14682

(cherry picked from commit fe62a3f985)
2023-06-07 08:22:47 -07:00
Marek Roszko 41447e9b44 Experiment with sentry breadcrumbs to footnote kiway events to provide more crash context
(cherry picked from commit 5b5176f104)
2023-06-07 11:02:23 +00:00
David Holdeman 7aa368c2c5 use same flag, fix inversion 2023-06-06 18:20:24 +00:00
David Holdeman 6a00eaa4a3 naively add option 2023-06-06 18:20:24 +00:00
Jeff Young 9240566167 Support shape collisions between SHAPE_POLY_SET and other shapes.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14890

(cherry picked from commit 0f8c5a96b2)
2023-06-06 13:41:37 +01:00
Jeff Young 9eaa5f90e0 Replace larger text bboxes now that we're not using them for knockouts.
(cherry picked from commit 570978fa7f)
2023-06-06 11:19:41 +01:00
Jeff Young 214f785c97 Use rendered text to generate bounding box for knockout text.
Don't open-code knockout text shape generation in several different
places.

Make sure triangulated knockout text gets clearance added when
specified.

Collapse duplicated footprint text item plot routine (they're no
longer any different from plotting pcb text items).

(cherry picked from commit c71cf21e2f)
2023-06-06 11:19:41 +01:00
Jeff Young ae0534cbb4 Account for changes to mimic 6.0 text positioning in bounding boxes.
This is only a partial fix as knockout text is still busted....

(cherry picked from commit dacf0b2b96)
2023-06-06 11:19:41 +01:00
Jeff Young f3c5c458c6 Formatting.
(cherry picked from commit 6b0bff2f4f)
2023-06-06 11:19:41 +01:00
Marek Roszko d6fd5598ab Use the correct printf format for the move individually status text
Fixes sentry KICAD-1ZT


(cherry picked from commit b41606ecf7)
2023-06-05 13:55:52 +00:00
Mike Williams c41b334f0a LibTree: add numpad enter as enter
Written by Andrej Valek
2023-06-05 09:22:04 -04:00
Mike Williams c3a6bf3d40 UI: Add Numpad Enter as "Return" equivalent in missing places
Fixes: https://gitlab.com/kicad/code/kicad/-/issues/14244
2023-06-05 08:58:50 -04:00
Jeff Young cb7aa5143b Correctly handle hidden columns when pasting into grids.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14844

(cherry picked from commit f9fd37c4ca)
2023-06-04 21:24:35 +01:00
Jeff Young 8942abfc64 Handle through-hole via walls along with pads.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14757

(cherry picked from commit cb7f314f4b)
2023-06-04 21:22:37 +01:00
Jeff Young e5ef973d52 Trim solder paste (and other layers) to holes.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/8484

(cherry picked from commit b53bc1ae38)
2023-06-04 21:22:31 +01:00
Jeff Young 0bd45f691e Make sure 3D file browser is treated as modal by quit.
(Otherwise we crash when freeing it during the quit.)

(cherry picked from commit c36b0fcda7)
2023-06-04 21:22:19 +01:00
Jeff Young 117c70ed7d Don't double-up FUTURE_FORMAT_ERROR problem strings.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14780

(cherry picked from commit e82e4af483)
2023-06-04 21:21:18 +01:00
Jeff Young d09f88d53b Every time I search for SCH_TEXT* it doesn't work....
(cherry picked from commit b8986709bf)
2023-06-04 21:15:36 +01:00
Jeff Young 06f17d9415 Don't call OnPageSettingsChanges on Undo/Redo.
It's incredibly expensive (multiple seconds on a document with
lots of text in an outline font).

(cherry picked from commit 81d7428fd2)
2023-06-04 21:15:30 +01:00
Jeff Young c1d8e979f3 Spread the error-bar move evenly around justified text.
(cherry picked from commit 3ab9175553)
2023-06-04 21:15:22 +01:00
Jeff Young 16f286735d Cache LIB_PIN text extents for performance.
Also fixes a bug where we didn't triangulate at all when the char
count didn't warrant the likely overhead of spinning up a
thread_pool.

And fix another bug where EDA_TEXT::GetRenderCache() wasn't using
the given font.

Also reverts using the cache for drawing-sheet text.  The text
items are created from scratch from the data items each time
they're drawn, so there's never an existing cache to make use of.
Instead, we now check that the item is in the view, using a very
approximate bounding box generator (because even generating a
real bounding box shows up large in profiles).

And, lastly, fixes a bug where EndPos was never considered in
DS_DATA_ITEM::IsInsidePage().

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14822

(cherry picked from commit f35a88ce0b)
2023-06-04 21:11:06 +01:00
Jeff Young 45c7490180 Outline font performance improvements.
1) Don't fracture font glyphs when generating them; we're going
   to fracture during triangulation anyway.
2) Don't check for self-intersection when deciding to fracture.
   It costs nearly as much as the fracture does.
3) Cache drawing sheet text.
4) Use the current font when checking for cache validity.
5) Parallelize glyph triangulation.
6) Don't invalidate bounding box caches when offset by {0,0}
7) Use the glyph cache when generating text effective shape.
8) Short-circuit NormalizeJustification() if its center/center.
9) Don't triangulate for GuessSelectionCandidates()
10) Avoid sqrt whenever possible.
11) Pre-allocate bezier and SHAPE_LINE_CHAIN buffers.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14303

(cherry picked from commit 4ed267394a)
2023-06-04 20:57:14 +01:00
Jeff Young 1566b357cb Improve appearance of stroked knockout text.
(cherry picked from commit ff37ebe61a)
2023-06-04 20:56:05 +01:00
Seth Hillbrand 7d9222926a Connectivity: Correct alias-based bus resolution
Aliases in bus resolution were being resolved without a path, making
them effectively global nets.  This applies the corrected path to the
bus members and adds a QA to catch this error
2023-06-02 14:25:26 -07:00
Alex b957d5176e Fix view shifting when infobar is shown.
(cherry picked from commit df4fefeb20)
2023-06-02 18:07:48 +03:00
Jeff Young e76a520c19 Bug fixes for handling boolean flags in DRC rules.
(cherry picked from commit cb53a18ee3)
2023-06-02 00:20:11 +01:00
Jeff Young f0d205fed9 Don't use GetValueFieldText from within text var resolution.
(It resets the recursion checker.)

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14815

(cherry picked from commit 5114d3b8c3)
2023-06-02 00:17:35 +01:00
Marek Roszko 42811d0602 Fix blank symbol svg export file names
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14857


(cherry picked from commit c2d56eefb9)
2023-06-01 00:56:40 +00:00
jean-pierre charras b54c03f89e Cvpcb: the footprint viewer use the settings of pcbnew, and the code in _pcbnew.dll/so
So ensure they are loaded before creating the footprint viewer.
Fixes #14850
https://gitlab.com/kicad/code/kicad/-/issues/14850
2023-05-30 20:11:15 +02:00
jean-pierre charras 5596790a6e Symbol editor: ensure a new derived symbol has the correct DeMorgan option displayed.
Derived symbols use the same graphics as their parent, so ensure the parent is
used to enable/disable the DeMorgan option and tool in toolbar
Fixes #13739
https://gitlab.com/kicad/code/kicad/-/issues/13739
2023-05-29 20:41:35 +02:00
jean-pierre charras e55263be00 Pcbnew: fix crash when trying to save a board with a text with overbar and
using a non Kicad font
PCB_PLUGIN::formatRenderCache() was considering all shapes in cache are polygons,
but this is not true: some items can be stroke shapes.
From stable branch
Fixes #14804
https://gitlab.com/kicad/code/kicad/-/issues/14804
2023-05-29 20:41:35 +02:00
Wayne Stambaugh 441c2b50b9 Fix potential stale pointer bug in schematic highlight connection code.
SCH_CONNECTION objects are temporary and can become stale any time the
connectivity is updated.  Keeping them around to reference later is a
bad idea.  Even if the object pointer is still valid in an SCH_ITEM in
the undo/redo buffers, comparing the pointer against another pointer as
a test to see if they are the same connection is not valid.  Saving the
connection name is safe and ensures the connection is the same even if
the pointers differ.

(cherry picked from commit 831a6d55fc)
2023-05-29 13:55:07 -04:00
jean-pierre charras 0a3f5b65bf Fix last changes in io.cpp for msys2.
- use the same code for msys2 and msvc
- add an option to use a fallback for msys2 if the common code does not compile
2023-05-29 13:38:52 -04:00
Marek Roszko 93c29ad15e Add a sequential read flagged fopen helper
Trying to squeeze out some kind of gain by informing the OS we will read a file sequentially.
In particular our FILE_LINE_READER just uses fgetc until the end
2023-05-29 13:36:06 -04:00
Marek Roszko 8f565ef7f0 Replace the exception handler in another spot 2023-05-28 22:31:29 -04:00
Marek Roszko d97de297af Move 3 more blocks to the common ex handler 2023-05-28 22:31:18 -04:00
Marek Roszko 18ac4c2288 Handle OnKifaceStart exceptions without crashing 2023-05-28 22:30:07 -04:00
Marek Roszko 0c6eb6dec3 Create a central exception handler we can also use to generate sentry events
(cherry picked from commit c5d5450f55)
2023-05-29 02:27:21 +00:00
Jeff Young 4a274709e7 Go back to using QuasiModal for TextBox Properties.
Also removes auto-closing of blocking dialogs when inserting
symbols from the Symbol Editor or Chooser, preventing the bug
that QuasiModel was removed for earlier.

Also fixes a non-initialized parent pointer when the TextBox
Properties dialog was called from DrawShape().

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14777

(cherry picked from commit 5a9ed66cfd)
2023-05-28 19:19:50 +01:00
Jeff Young c6e4f18d99 Hook up text variable auto-complete for PCBNew.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14777

(cherry picked from commit 14f004d2a5)
2023-05-28 18:46:39 +01:00
Wayne Stambaugh 0e5155ae2f Fix clipped combobox entry in board editor text box dialog.
The layer combobox color swatch was clipped when the combobox was
closed when the dialog was launched.  Setting the minimum width
resolved the issue.  This may have been a GTK only issue.

(cherry picked from commit a13a49f45a)
2023-05-28 18:43:32 +01:00
Jeff Young aa78abc649 Manual reimplementation of 84c72b087c
(cherry picked from commit 7cc55d2d3a)
2023-05-28 19:38:27 +02:00
Jeff Young 1c62fc868d Fix more SPICE case-insensitivity bugs.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14793

(cherry picked from commit 03486443c7)
(cherry picked from commit e5d5335701)
2023-05-28 19:38:27 +02:00
Mark Visser f9c2f03a44 fix bug whereby spice params with capital letters no longer cause an error and data loss
Spice parameters were converted to lower-case before comparison. This is incorrect, as it
is legal and common for spice parameters to contain capital letters (e.g. potentiometers
typically use Rt and SET as their parameters).
Spice parameters are not case sensitive, so the correct behaviour is to instead do a
case-insensitive comparison on the parameter name.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14793

(cherry picked from commit 0d235ac64b)
(cherry picked from commit 888a35bbde)
2023-05-28 19:38:27 +02:00
Jeff Young dfd11b7596 Reconcile PNS router with DRC.
Hole-to-hole is only for drilled holes.
NPTH slots also get EDGE_CLEARANCE applied.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14771

(cherry picked from commit df763eaf88)
(cherry picked from commit ad9109cad4)
2023-05-28 19:38:27 +02:00
Jeff Young 98796f6250 Reset button applies to resolved page, not lazy page holder.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14786

(cherry picked from commit 1057483983)
(cherry picked from commit 232d0e8b6b)
2023-05-28 19:38:27 +02:00
Jeff Young b728251bcc STL is your friend... until it's not.
Operator[] was creating an empty entry in the connectivity map,
fooling us into thinking the item had already been added.

Worryingly, this bug has been in there since 2017; a recent
change in teardrops just happened to expose it.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14781

(cherry picked from commit 7e51077992)
(cherry picked from commit 0d94532df9)
2023-05-28 19:38:27 +02:00
Jeff Young d894faaeaa Pin preferences dialog size.
While unfortunate (we generally frown on having fixed sizes in
favour of having everything auto-layout), in this case it's a
cost of lazy-loading the panels.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14785

(cherry picked from commit cbf83c4161)
(cherry picked from commit 799302cd6d)
2023-05-28 19:38:27 +02:00
Jeff Young 8b114c81c5 Fix issue with colours in the new lazy-loaded preference panels.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14784

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14782

(cherry picked from commit d4c9d9d60a)
(cherry picked from commit c33b3fd314)
2023-05-28 19:38:27 +02:00
Jeff Young 97ffb60f23 Don't consider shorted items when opitmizing ratsnest.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14715

(cherry picked from commit 80aef37cc4)
(cherry picked from commit dc50b7b065)
2023-05-28 19:38:27 +02:00
Jeff Young 41b7182661 Lazy loading of stackup UI widgets.
(cherry picked from commit 9481a218c7)
(cherry picked from commit 00a82905ec)
2023-05-28 19:38:27 +02:00
Jeff Young 19e5a231a7 Don't run onPageChanged() event handler during initialization.
(cherry picked from commit 3f44c811c7)
(cherry picked from commit f35ed59868)
2023-05-28 19:38:27 +02:00
Jeff Young 01fcb2276b Move remainder of Board Setup to lazy loading.
(cherry picked from commit 03c9b1c202)
(cherry picked from commit 3cd87c2a44)
2023-05-28 19:38:27 +02:00
Jeff Young 19b4e98ee7 Lazy loading of Schematic Setup panels.
(cherry picked from commit ddc6ecf7be)
(cherry picked from commit 6cbc10db81)
2023-05-28 19:38:27 +02:00
Jeff Young 77c76bbc8a Insta-prefs.
(cherry picked from commit 9ae8255202)
(cherry picked from commit 4c28070449)
2023-05-28 19:38:27 +02:00
Jeff Young 00bb1636da Don't store sizes in panels. Let them auto-lay-out.
(cherry picked from commit 6bf43588bb)
(cherry picked from commit bf4f6cff3c)
2023-05-28 19:38:27 +02:00
jean-pierre charras 50ec496c54 Step exporter: export circular board outlines as cylinder
From master branch, commit 66651327.

(cherry picked from commit 5db9a6af9d)
2023-05-28 19:38:27 +02:00
jean-pierre charras 2b8ad1b65c Eeschema: fix block mirroring of fields attached to labels (all types)
Fix incorrect orientation of the graphic shape of SCH_DIRECTIVE_LABEL items
after mirroring the item.
Similar to commit 898d88cc, but for block mirroring.
Fixes #14758
https://gitlab.com/kicad/code/kicad/-/issues/14758

(cherry picked from commit b968bac318)
2023-05-28 19:38:27 +02:00
Wayne Stambaugh 5c5f077a4a Begin version 7.0.6 development. 2023-05-26 08:36:00 -04:00
Wayne Stambaugh b05f6f1614 Tag release version 7.0.5. 2023-05-26 08:35:08 -04:00
Tomasz Wlostowski 0180cb380f router: prevent pushout/bogus collision of via with is own hole (or copper) when dragging
The root cause was not removing the original (pre-dragging) via from the world, comparing the ITEM::Parent() pointers of the items was only hiding the main issue.
This also fixes the PNSViaCollisions test in the qa/ suite.
2023-05-24 19:47:20 -07:00
Jeff Young 882e48b457 Don't allow collisions with self.
The previous test didn't handle is-self-tests between a hole and
its override in a different NODE.  When calculating the pushout
force we don't remove the via (and its hole) from the current
node until after the calculation, so we end up checking for
collisions between the new (cloned) via's hole and the original
hole in the root node.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14795

(cherry picked from commit b442d769fd)
2023-05-24 08:54:27 -07:00
Seth Hillbrand fa56b17c88 Revert "Fix clipped combobox entry in board editor text box dialog."
This reverts commit 7ea907c343.
2023-05-24 08:54:16 -07:00
Seth Hillbrand 6b1c2da867 Revert "Eeschema: fix block mirroring of fields attached to labels (all types)"
This reverts commit b968bac318.
2023-05-24 08:54:16 -07:00
Seth Hillbrand 84eacd13a1 Revert "Step exporter: export circular board outlines as cylinder"
This reverts commit 5db9a6af9d.
2023-05-24 08:54:16 -07:00
Seth Hillbrand b6bd1a9373 Revert "Don't store sizes in panels. Let them auto-lay-out."
This reverts commit bf4f6cff3c.
2023-05-24 08:54:16 -07:00
Seth Hillbrand 7e39411910 Revert "Insta-prefs."
This reverts commit 4c28070449.
2023-05-24 08:54:16 -07:00
Seth Hillbrand 2f3659e7ac Revert "Lazy loading of Schematic Setup panels."
This reverts commit 6cbc10db81.
2023-05-24 08:54:16 -07:00
Seth Hillbrand c0567aa011 Revert "Move remainder of Board Setup to lazy loading."
This reverts commit 3cd87c2a44.
2023-05-24 08:54:16 -07:00
Seth Hillbrand 9b310ab955 Revert "Don't run onPageChanged() event handler during initialization."
This reverts commit f35ed59868.
2023-05-24 08:54:16 -07:00
Seth Hillbrand 5226855158 Revert "Lazy loading of stackup UI widgets."
This reverts commit 00a82905ec.
2023-05-24 08:54:16 -07:00
Seth Hillbrand ee19354484 Revert "Don't consider shorted items when opitmizing ratsnest."
This reverts commit dc50b7b065.
2023-05-24 08:54:16 -07:00
Seth Hillbrand e967020ebe Revert "Fix issue with colours in the new lazy-loaded preference panels."
This reverts commit c33b3fd314.
2023-05-24 08:54:16 -07:00
Seth Hillbrand 7b0d45402a Revert "Pin preferences dialog size."
This reverts commit 799302cd6d.
2023-05-24 08:54:16 -07:00
Seth Hillbrand 714250d9f6 Revert "STL is your friend... until it's not."
This reverts commit 0d94532df9.
2023-05-24 08:54:16 -07:00
Seth Hillbrand b4e3ce1166 Revert "Reset button applies to resolved page, not lazy page holder."
This reverts commit 232d0e8b6b.
2023-05-24 08:54:16 -07:00
Seth Hillbrand 1958cafbdf Revert "Reconcile PNS router with DRC."
This reverts commit ad9109cad4.
2023-05-24 08:54:16 -07:00
Seth Hillbrand 248de56fb0 Revert "fix bug whereby spice params with capital letters no longer cause an error and data loss"
This reverts commit 888a35bbde.
2023-05-24 08:54:16 -07:00
Seth Hillbrand 89349c1084 Revert "Fix more SPICE case-insensitivity bugs."
This reverts commit e5d5335701.
2023-05-24 08:54:16 -07:00
Seth Hillbrand e2c0c6362f Revert "Manual reimplementation of 84c72b087c548829908d7fbbecfd2fa5968cc98b"
This reverts commit 7cc55d2d3a.
2023-05-24 08:54:16 -07:00
Jeff Young 7cc55d2d3a Manual reimplementation of 84c72b087c 2023-05-23 09:40:32 +01:00
Jeff Young e5d5335701 Fix more SPICE case-insensitivity bugs.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14793

(cherry picked from commit 03486443c7)
2023-05-23 09:40:32 +01:00
Mark Visser 888a35bbde fix bug whereby spice params with capital letters no longer cause an error and data loss
Spice parameters were converted to lower-case before comparison. This is incorrect, as it
is legal and common for spice parameters to contain capital letters (e.g. potentiometers
typically use Rt and SET as their parameters).
Spice parameters are not case sensitive, so the correct behaviour is to instead do a
case-insensitive comparison on the parameter name.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14793

(cherry picked from commit 0d235ac64b)
2023-05-23 09:40:32 +01:00
Jeff Young ad9109cad4 Reconcile PNS router with DRC.
Hole-to-hole is only for drilled holes.
NPTH slots also get EDGE_CLEARANCE applied.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14771

(cherry picked from commit df763eaf88)
2023-05-23 09:40:32 +01:00
Jeff Young 232d0e8b6b Reset button applies to resolved page, not lazy page holder.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14786

(cherry picked from commit 1057483983)
2023-05-23 09:40:32 +01:00
Jeff Young 0d94532df9 STL is your friend... until it's not.
Operator[] was creating an empty entry in the connectivity map,
fooling us into thinking the item had already been added.

Worryingly, this bug has been in there since 2017; a recent
change in teardrops just happened to expose it.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14781

(cherry picked from commit 7e51077992)
2023-05-23 09:40:32 +01:00
Jeff Young 799302cd6d Pin preferences dialog size.
While unfortunate (we generally frown on having fixed sizes in
favour of having everything auto-layout), in this case it's a
cost of lazy-loading the panels.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14785

(cherry picked from commit cbf83c4161)
2023-05-23 09:40:32 +01:00
Jeff Young c33b3fd314 Fix issue with colours in the new lazy-loaded preference panels.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14784

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14782

(cherry picked from commit d4c9d9d60a)
2023-05-23 09:40:32 +01:00
Jeff Young dc50b7b065 Don't consider shorted items when opitmizing ratsnest.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14715

(cherry picked from commit 80aef37cc4)
2023-05-23 09:40:32 +01:00
Jeff Young 00a82905ec Lazy loading of stackup UI widgets.
(cherry picked from commit 9481a218c7)
2023-05-23 09:40:32 +01:00
Jeff Young f35ed59868 Don't run onPageChanged() event handler during initialization.
(cherry picked from commit 3f44c811c7)
2023-05-23 09:40:32 +01:00
Jeff Young 3cd87c2a44 Move remainder of Board Setup to lazy loading.
(cherry picked from commit 03c9b1c202)
2023-05-23 09:40:32 +01:00
Jeff Young 6cbc10db81 Lazy loading of Schematic Setup panels.
(cherry picked from commit ddc6ecf7be)
2023-05-23 09:40:32 +01:00
Jeff Young 4c28070449 Insta-prefs.
(cherry picked from commit 9ae8255202)
2023-05-23 09:40:32 +01:00
Jeff Young bf4f6cff3c Don't store sizes in panels. Let them auto-lay-out.
(cherry picked from commit 6bf43588bb)
2023-05-23 09:40:32 +01:00
jean-pierre charras 5db9a6af9d Step exporter: export circular board outlines as cylinder
From master branch, commit 66651327.
2023-05-23 10:25:58 +02:00
jean-pierre charras b968bac318 Eeschema: fix block mirroring of fields attached to labels (all types)
Fix incorrect orientation of the graphic shape of SCH_DIRECTIVE_LABEL items
after mirroring the item.
Similar to commit 898d88cc, but for block mirroring.
Fixes #14758
https://gitlab.com/kicad/code/kicad/-/issues/14758
2023-05-23 09:47:29 +02:00
Wayne Stambaugh 7ea907c343 Fix clipped combobox entry in board editor text box dialog.
The layer combobox color swatch was clipped when the combobox was
closed when the dialog was launched.  Setting the minimum width
resolved the issue.  This may have been a GTK only issue.

(cherry picked from commit a13a49f45a)
2023-05-22 12:06:13 -04:00
Jon Evans b71d66de94 Specctra: remove grouped tracks from group before cleaning up
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14763


(cherry picked from commit 27afd22bbf)
2023-05-22 14:58:56 +00:00
Wayne Stambaugh 06043b4a14 Begin version 7.0.5 development. 2023-05-21 16:36:43 -04:00
Wayne Stambaugh d836d7187e Tag release version 7.0.4. 2023-05-21 16:35:11 -04:00
Alex b0ecb5b62d Fix opening boards with deprecated features.
(cherry picked from commit 9d452a6097)
2023-05-20 08:29:23 +03:00
Seth Hillbrand 09febce4ce Update translations 2023-05-18 11:58:33 -07:00
Henrik Kauhanen c5621ff44b Translated using Weblate (Swedish)
Currently translated at 99.9% (8010 of 8014 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/sv/
2023-05-18 20:53:23 +02:00
dsa-t d58f3114cc Translated using Weblate (Russian)
Currently translated at 100.0% (8014 of 8014 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/ru/
2023-05-18 20:53:23 +02:00
Wellington Terumi Uemura e1caaed3cf Translated using Weblate (Portuguese (Brazil))
Currently translated at 100.0% (8014 of 8014 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/pt_BR/
2023-05-18 20:53:23 +02:00
Henrik Kauhanen 11959f5023 Translated using Weblate (Finnish)
Currently translated at 99.8% (8002 of 8014 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/fi/
2023-05-18 20:53:23 +02:00
Toni Laiho 197e5f920d Translated using Weblate (Finnish)
Currently translated at 99.8% (8002 of 8014 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/fi/
2023-05-18 20:53:23 +02:00
Ulices e1300a9342 Translated using Weblate (Spanish (Mexico))
Currently translated at 100.0% (8014 of 8014 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/es_MX/
2023-05-18 20:53:23 +02:00
Miklós Márton 524d2572aa Translated using Weblate (Hungarian)
Currently translated at 0.2% (23 of 8014 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/hu/
2023-05-18 20:53:23 +02:00
Henrik Kauhanen 340bab73f5 Translated using Weblate (Swedish)
Currently translated at 99.9% (8010 of 8014 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/sv/
2023-05-18 20:53:23 +02:00
dsa-t 8d1529cc48 Translated using Weblate (Russian)
Currently translated at 100.0% (8014 of 8014 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/ru/
2023-05-18 20:53:23 +02:00
Wellington Terumi Uemura c501a73251 Translated using Weblate (Portuguese (Brazil))
Currently translated at 100.0% (8014 of 8014 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/pt_BR/
2023-05-18 20:53:22 +02:00
István Farkas 6b1c02526f Translated using Weblate (Hungarian)
Currently translated at 0.1% (6 of 8014 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/hu/
2023-05-18 20:53:22 +02:00
Toni Laiho d8d7284c35 Translated using Weblate (Finnish)
Currently translated at 99.8% (8002 of 8014 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/fi/
2023-05-18 20:53:22 +02:00
jean-pierre charras a5a8b93a2e Eeschema, directive labels: fix some issues:
- honor mirroring of fields attached to labels (all types)
- fix incorrect orientation of the graphic shape of SCH_DIRECTIVE_LABEL items
after mirroring the item.
Form master branch
Fixes #14758
https://gitlab.com/kicad/code/kicad/issues/14758
2023-05-18 11:22:36 +02:00
jean-pierre charras a72fd0ebdd Simulator: Ensure connectivity is up to date (incremental mode) before building netlist
also: SIM_PLOT_FRAME::onShowNetlist(): verify all symbols are annotated.
2023-05-18 10:45:52 +02:00
Seth Hillbrand d5bd1f5aea Cleanup text alignment between version 6 and 7
Version 7 text alignment changed subtly for stroke fonts from version 6.
Additionally, the output has been different between screen and plotting,
leading to offset text in plotted output relative to the text shown on
screen.

This introduces a fudge factor in FONT::getLinePositions to correct the
offset in the plotting output relative to v6.

This also changes the SCH_PAINTER and PCB_PAINTER to correct the
relative offsets between GAL and PLOTTER classes.  The source of these
offsets is atm unclear.

Fixes https://gitlab.com/kicad/code/kicad/issues/14755

(cherry picked from commit 0de24bfd59)
2023-05-17 15:29:49 -07:00
Ian McInerney 17c27d1176 Fix GitLab URLs to point to the correct project page
GitLab 16.0 removes support for URLs that don't contain /-/ after the
repository name, so the report bug feature and various links we had in
the source (including the git-fixes script) would lead to a 404 error.

See GitLab docs for deprecation/removal notice:
https://docs.gitlab.com/ee/update/deprecations.html?removal_milestone=16.0#legacy-urls-replaced-or-removed

(Cherry-picked from 20ec8ed303)

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/14759
2023-05-17 13:42:48 +01:00
jean-pierre charras df698b9433 NETLIST_EXPORTER_SPICE: add space to the not allowed chars in netnames
Not allowed chars are replaced by '_'
From master branch
Fixes #14724
https://gitlab.com/kicad/code/kicad/issues/14724
2023-05-16 19:50:24 +02:00
Mark Roszko 2ea59ac83a Update file doxygen.yml 2023-05-15 14:28:27 +00:00
Marco Ciampa 4264e5bee3 Updated Italian translation 2023-05-15 10:19:32 +02:00
Jon Evans 411bcc58c5 Use the right path for recursing in text var resolution
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14720


(cherry picked from commit 3686c5b371)
2023-05-14 23:12:30 +00:00
Jon Evans f02cd717bc PNS: Collision search context may be null
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14741


(cherry picked from commit 94130716a5)
2023-05-14 21:21:19 +00:00
Alex 91f40ac779 Make sure text bounding box exists when syncing PNS world.
Based on d790865549

Fixes https://gitlab.com/kicad/code/kicad/issues/14733
2023-05-14 15:37:45 +03:00
Wayne Stambaugh 04ffee8e82 Begin version 7.0.4 development. 2023-05-12 18:28:52 -04:00
Wayne Stambaugh 54253ba8a3 Tag release version 7.0.3. 2023-05-12 18:26:28 -04:00
Seth Hillbrand ddd533ee9c Update translations 2023-05-12 12:57:57 -07:00
taotieren 46133c76b2 Translated using Weblate (Chinese (Traditional))
Currently translated at 99.9% (8011 of 8014 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/zh_Hant/
2023-05-12 21:55:02 +02:00
taotieren d4e9ace354 Translated using Weblate (Chinese (Simplified))
Currently translated at 100.0% (8014 of 8014 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/zh_Hans/
2023-05-12 21:55:02 +02:00
Miklós Márton 88dd914a31 Translated using Weblate (Hungarian)
Currently translated at 37.1% (2976 of 8014 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/hu/
2023-05-12 21:55:02 +02:00
Toni Laiho ca68d32a47 Translated using Weblate (Finnish)
Currently translated at 99.8% (8002 of 8014 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/fi/
2023-05-12 21:55:02 +02:00
Ulices 3c86dbe28c Translated using Weblate (Spanish (Mexico))
Currently translated at 99.9% (8013 of 8014 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/es_MX/
2023-05-12 21:55:02 +02:00
taotieren 400bac868e Translated using Weblate (Chinese (Simplified))
Currently translated at 99.9% (8006 of 8014 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/zh_Hans/
2023-05-12 21:55:02 +02:00
Hubert Hu 7e765db562 Translated using Weblate (Chinese (Simplified))
Currently translated at 99.8% (7998 of 8014 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/zh_Hans/
2023-05-12 21:55:02 +02:00
Jan Straka a993e179ab Translated using Weblate (Czech)
Currently translated at 90.9% (7285 of 8014 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/cs/
2023-05-12 21:55:02 +02:00
Henrik Kauhanen 5253ff35f1 Translated using Weblate (Swedish)
Currently translated at 99.8% (7998 of 8014 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/sv/
2023-05-12 21:55:01 +02:00
Wellington Terumi Uemura cba0ec4de5 Translated using Weblate (Portuguese (Brazil))
Currently translated at 100.0% (8014 of 8014 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/pt_BR/
2023-05-12 21:55:01 +02:00
Toni Laiho ed0354dd06 Translated using Weblate (Finnish)
Currently translated at 99.8% (7998 of 8014 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/fi/
2023-05-12 21:55:01 +02:00
Ettore Atalan d255d6aeeb Translated using Weblate (German)
Currently translated at 99.5% (7981 of 8014 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/de/
2023-05-12 21:55:01 +02:00
Ulices 94abd0ee79 Translated using Weblate (Spanish (Mexico))
Currently translated at 99.9% (8013 of 8014 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/es_MX/
2023-05-12 21:55:01 +02:00
dsa-t 6a3cd9c0d7 Translated using Weblate (Russian)
Currently translated at 99.9% (8012 of 8015 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/ru/
2023-05-12 21:55:01 +02:00
Seth Hillbrand 81be16d058 Adjust stroke font output to match v6 output
Many minor tweaks were added that changed the output of the stroke font
from v5/v6.  These offsets changed the gerber output expected.  This
reverts the changes to something much closer to the v6 output.  It is
not pixel-perfect but gets very close on most texts.

Fixes https://gitlab.com/kicad/code/kicad/issues/14609

(cherry picked from commit 72267cf9b0)
2023-05-12 12:53:32 -07:00
Alex 3efdc963d8 Revert string change.
String changed in 9466624f9d
2023-05-12 21:26:16 +03:00
Seth Hillbrand a4525bf88c Test for schematic type when changing
The schematic editor undo list may hold page layout types as well

(cherry picked from commit 2ffb58a7e2)
2023-05-12 08:44:22 -07:00
Alex d7c7ff3dad Fix pre-commit symlink
(cherry picked from commit fe2e5cbfa6)
2023-05-12 13:12:50 +00:00
Alex 987aec3fd6 Revert change in git pre-commit hook.
(cherry picked from commit 28fd5f75c8)
2023-05-12 12:51:07 +00:00
Alex d5661c24bd Prevent axes settings from affecting angles in properties panel.
Fixes https://gitlab.com/kicad/code/kicad/issues/14168


(cherry picked from commit f7f15e1ddf)
2023-05-12 12:50:25 +00:00
Alex c3ee1111f9 Fix double negative signs in mask/paste margin overrides.
(cherry picked from commit efbd360440)
2023-05-12 12:45:09 +00:00
Salvador E. Tropea 9c1509b8c3 Provide some degree of compatibility for GetShownText in Python
This patch keeps the new API for GetShownText (argument order inverted), but also allows calling the member without parameters.
2023-05-11 23:39:09 +00:00
Steve Bollinger 1020cdd7a6 pcbnew: switching track posture may not work on first attempt
If you drag a track out and connect to a pad then press the hotkey
to switch the track posture it may not switch because the track
posture selected when the pad was reached is different than the one
that the mouse trail placer drew. As the aspect switching is done
in the mouse trail placer it does not know that the line placer
already override the track.

To correct this, in LINE_PLACER::FlipPosture() if the aspect is not
currently manually forced then copy the current aspect from the
line placer to m_mouseTrailPlacer before calling the FlipPosture()
method of m_mouseTrailPlacer. This will only be done once per
dragging session as once the aspect is manually forced it remains
manually forced. This seems to fix the issue with no undesirable
side effects.

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/12369
(cherry picked from commit 85f4f0d6c8)
2023-05-11 16:36:21 -07:00
Seth Hillbrand bff2f53996 Correct alpha blending in PDF plot
We fake the alpha channel by pre-multiplying but we forgot to account
for the downscaling of the input channel value in addition to correcting
the alpha * white.  This led to clipping when the values overflowed

Fixes https://gitlab.com/kicad/code/kicad/issues/14238

(cherry picked from commit d405fff1d8)
2023-05-11 16:27:15 -07:00
Seth Hillbrand d5bf831f60 Ensure that even open paths with fills are filled
SVG paths that are "open" can still have a fill internally, so avoid
dropping fills for these non-standard polygons

Fixes https://gitlab.com/kicad/code/kicad/issues/14518

(cherry picked from commit b56db30019)
2023-05-11 16:27:15 -07:00
Seth Hillbrand 6c423be36f Don't consider saving SCH_MARKERs
These are ephemeral, view-only elements, so don't include them in our
save map

Fixes https://gitlab.com/kicad/code/kicad/issues/11405

(cherry picked from commit 7eb728ca12)
2023-05-11 16:27:15 -07:00
Seth Hillbrand 3c33e2c046 3dviewer: Show footprint board regardless of proj
The settings for the project in terms of visibility should not impact
our ability to preview the 3d model of a footprint

Fixes https://gitlab.com/kicad/code/kicad/issues/14246

(cherry picked from commit d7a6875b0b)
2023-05-11 16:27:15 -07:00
Jon Evans 253ff41819 PNS: make sure context options are used in collideSimple
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14659


(cherry picked from commit 89aae88e96)
2023-05-11 20:48:56 +00:00
Jon Evans 24d95b410d PNS: Don't use clearance epsilon for calculating shove distances
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14707


(cherry picked from commit 2e60315959)
2023-05-11 20:48:46 +00:00
Graham Keeth db5aacf984 sim: fix diode model default breakdown voltage
(Cherry-picked from 2970d97bf2)
2023-05-11 13:15:37 +01:00
Graham Keeth 111a56dd8a sim: fixup some diode parameter units
(cherry picked from commit df3560ab8e)
2023-05-11 01:15:52 +00:00
qu1ck d1d0d61b4f Add usable PCB_GROUP::GetItems() swig wrapper
(cherry picked from commit 9b58f50c68)
2023-05-11 01:15:17 +00:00
Martin Thierer 640f279abe Pcbnew: Fix rotating bitmaps
Fixes rotating bitmaps with "rotate counterclockwise",
"rotate clockwise" and "move exactly" commands.

Only rotation by 0, 90, 180 and 270 degrees is supported
for bitmaps. Other values are rounded to the nearest 90
degree multiple.

There is a different bug that this commit doesn't address,
which is that BITMAP_BASE::Rotate() got its CW/CCW logic
reversed ("m_image->Rotate( false )" should rotate CW, but
does not).

Fixes https://gitlab.com/kicad/code/kicad/issues/14197


(cherry picked from commit 45b94a4b3e)
2023-05-11 01:14:34 +00:00
qu1ck 874191bd8d Don't disable reload button in action plugins preferences
(cherry picked from commit a86aa6fc3e)
2023-05-11 01:13:42 +00:00
Salvador E. Tropea 2066af9f28 Fix wxWidgets compilation issue.
wxFileName::GetAbsolutePath was introduced in 3.1.6:
https://docs.wxwidgets.org/3.2.2/classwx_file_name.html#a5ca18cc7b7af3d88a850fad22f993061

This patch is equivalent to the current code:
https://github.com/wxWidgets/wxWidgets/blob/d39aac0fa8882f4a192e760ef2f20c06fe27ce09/include/wx/filename.h#L390
2023-05-10 16:34:46 +00:00
Jon Evans ef7b3c1715 Use constraints to determine netclas width
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14190


(cherry picked from commit 61d30ee5bc)
2023-05-10 16:10:30 +00:00
Jon Evans 6eb96851f9 Don't try to open files multiple times
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14703


(cherry picked from commit 09e8f72196)
2023-05-10 16:09:32 +00:00
jean-pierre charras a42ef9de77 Navlib: Ensure a pointer is initialized. 2023-05-10 09:36:51 +02:00
jean-pierre charras fb23fe3084 fix a minor compil warning. 2023-05-10 09:36:51 +02:00
Seth Hillbrand 57f0150a23 Ensure _changed_ netlist is propagated
The propagation is currently (maybe not needed) limited to the global
name that is the source of the change.  We also need to propagate the
global name that is changed in case the global is set in a tree leaf and
not the root

Fixes https://gitlab.com/kicad/code/kicad/issues/14657

(cherry picked from commit 6e4de18e15)
2023-05-09 12:13:30 -07:00
Seth Hillbrand 9b31a986b6 Update translations 2023-05-09 10:38:20 -07:00
Jeff Young 8fa46a1f9e Simplify previous fix to not include new strings. 2023-05-09 18:20:42 +01:00
Jeff Young d805f5ceff De Morgan conversions are equivalences, not additional items to simulate.
Fixes https://gitlab.com/kicad/code/kicad/issues/14230

(cherry picked from commit fdcc97e604)
2023-05-09 18:12:02 +01:00
Seth Hillbrand b4242e562d Update translations 2023-05-09 10:08:45 -07:00
Ivan Chuba 2effa810c1 Translated using Weblate (Ukrainian)
Currently translated at 99.9% (8008 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/uk/
2023-05-09 18:49:27 +02:00
Tokita, Hiroshi a78af6acc2 Translated using Weblate (Japanese)
Currently translated at 99.9% (8008 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/ja/
2023-05-09 18:49:27 +02:00
Toni Laiho fc084c84f4 Translated using Weblate (Finnish)
Currently translated at 99.9% (8010 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/fi/
2023-05-09 18:49:27 +02:00
Ulices a846ab7443 Translated using Weblate (Spanish (Mexico))
Currently translated at 100.0% (8011 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/es_MX/
2023-05-09 18:49:27 +02:00
Ken Ovo 9f53272d34 Translated using Weblate (German)
Currently translated at 99.7% (7993 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/de/
2023-05-09 18:49:27 +02:00
Hubert Hu aa53aac7be Translated using Weblate (Chinese (Simplified))
Currently translated at 99.9% (8010 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/zh_Hans/
2023-05-09 18:49:27 +02:00
Tokita, Hiroshi db984fcad9 Translated using Weblate (Japanese)
Currently translated at 99.9% (8008 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/ja/
2023-05-09 18:49:27 +02:00
CloverGit 607713cdae Translated using Weblate (Chinese (Simplified))
Currently translated at 99.9% (8010 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/zh_Hans/
2023-05-09 18:49:26 +02:00
김랑기 7de0a61de3 Translated using Weblate (Korean)
Currently translated at 99.9% (8010 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/ko/
2023-05-09 18:49:26 +02:00
Ivan Chuba 1838460c38 Translated using Weblate (Ukrainian)
Currently translated at 99.9% (8008 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/uk/
2023-05-09 18:49:26 +02:00
김랑기 3a4e00d0f5 Translated using Weblate (Korean)
Currently translated at 99.9% (8010 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/ko/
2023-05-09 18:49:26 +02:00
Tokita, Hiroshi a9bd82150b Translated using Weblate (Japanese)
Currently translated at 100.0% (8011 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/ja/
2023-05-09 18:49:26 +02:00
Jan Straka de5c3733d0 Translated using Weblate (Czech)
Currently translated at 91.0% (7295 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/cs/
2023-05-09 18:49:26 +02:00
boonchai k 3ff662e710 Translated using Weblate (Thai)
Currently translated at 89.8% (7199 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/th/
2023-05-09 18:49:26 +02:00
dsa-t 669571799b Translated using Weblate (Russian)
Currently translated at 100.0% (8011 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/ru/
2023-05-09 18:49:25 +02:00
Allan Nordhøy 81a98fc0d3 Translated using Weblate (Norwegian Bokmål)
Currently translated at 61.2% (4906 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/nb_NO/
2023-05-09 18:49:25 +02:00
Tokita, Hiroshi f10157fb24 Translated using Weblate (Japanese)
Currently translated at 99.9% (8010 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/ja/
2023-05-09 18:49:25 +02:00
Henrik Kauhanen 7d94508257 Translated using Weblate (Swedish)
Currently translated at 99.9% (8006 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/sv/
2023-05-09 18:49:25 +02:00
Jan Straka 262a8607d0 Translated using Weblate (Czech)
Currently translated at 90.7% (7267 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/cs/
2023-05-09 18:49:25 +02:00
Jan Straka fd44a9552a Translated using Weblate (Czech)
Currently translated at 90.4% (7244 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/cs/
2023-05-09 18:49:25 +02:00
Henrik Kauhanen 8e2d6d8cb2 Translated using Weblate (Swedish)
Currently translated at 99.9% (8006 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/sv/
2023-05-09 18:49:25 +02:00
minsu kim (0xGabriel) 13b73cb51f Translated using Weblate (Korean)
Currently translated at 100.0% (8011 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/ko/
2023-05-09 18:49:25 +02:00
Arnau Llovet Vidal 5f730ba360 Translated using Weblate (Catalan)
Currently translated at 58.0% (4653 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/ca/
2023-05-09 18:49:25 +02:00
Andrey Fedorushkov 79dbbadf2d Translated using Weblate (Russian)
Currently translated at 99.9% (8010 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/ru/
2023-05-09 18:49:24 +02:00
Henrik Kauhanen cd150c265f Translated using Weblate (Swedish)
Currently translated at 99.9% (8006 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/sv/
2023-05-09 18:49:24 +02:00
Tokita, Hiroshi 7a50a91eab Translated using Weblate (Japanese)
Currently translated at 100.0% (8011 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/ja/
2023-05-09 18:49:24 +02:00
Henrik Kauhanen b5561ee5d4 Translated using Weblate (Finnish)
Currently translated at 99.9% (8010 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/fi/
2023-05-09 18:49:24 +02:00
ssantos 8dcda7fe35 Translated using Weblate (Portuguese)
Currently translated at 99.8% (7999 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/pt/
2023-05-09 18:49:24 +02:00
Mark Hämmerling 9b679cc8dd Translated using Weblate (German)
Currently translated at 100.0% (8011 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/de/
2023-05-09 18:49:24 +02:00
Ivan Chuba 674f8cc936 Translated using Weblate (Estonian)
Currently translated at 4.9% (396 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/et/
2023-05-09 18:49:24 +02:00
Nguyễn Ngọc Khánh 51a43ef45b Translated using Weblate (Vietnamese)
Currently translated at 14.6% (1171 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/vi/
2023-05-09 18:49:24 +02:00
Jan Straka acc55d588a Translated using Weblate (Czech)
Currently translated at 90.3% (7241 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/cs/
2023-05-09 18:49:23 +02:00
Ettore Atalan d4990b30e9 Translated using Weblate (German)
Currently translated at 100.0% (8011 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/de/
2023-05-09 18:49:23 +02:00
Jan Straka 920a8d34ea Translated using Weblate (Czech)
Currently translated at 90.4% (7242 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/cs/
2023-05-09 18:49:23 +02:00
Ivan Chuba c8dfcf4b39 Translated using Weblate (Ukrainian)
Currently translated at 99.9% (8010 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/uk/
2023-05-09 18:49:23 +02:00
Ivan Chuba aa93632707 Translated using Weblate (Estonian)
Currently translated at 4.8% (386 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/et/
2023-05-09 18:49:23 +02:00
Luc cc55262cbc Translated using Weblate (German)
Currently translated at 99.9% (8010 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/de/
2023-05-09 18:49:23 +02:00
Nguyễn Ngọc Khánh f887b62a85 Translated using Weblate (Vietnamese)
Currently translated at 14.6% (1170 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/vi/
2023-05-09 18:49:23 +02:00
Toni Laiho 5b20781080 Translated using Weblate (Finnish)
Currently translated at 99.9% (8010 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/fi/
2023-05-09 18:49:23 +02:00
Nguyễn Ngọc Khánh 98a1efc123 Translated using Weblate (Vietnamese)
Currently translated at 14.5% (1169 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/vi/
2023-05-09 18:49:22 +02:00
Hubert Hu a628c1f5e4 Translated using Weblate (Chinese (Simplified))
Currently translated at 99.9% (8010 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/zh_Hans/
2023-05-09 18:49:22 +02:00
minsu kim (0xGabriel) 6588e8fabf Translated using Weblate (Korean)
Currently translated at 99.9% (8009 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/ko/
2023-05-09 18:49:22 +02:00
turkce 52d349538e Translated using Weblate (Turkish)
Currently translated at 49.7% (3982 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/tr/
2023-05-09 18:49:22 +02:00
Henrik Kauhanen aad2b3a492 Translated using Weblate (Swedish)
Currently translated at 99.9% (8006 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/sv/
2023-05-09 18:49:22 +02:00
Henrik Kauhanen 93180abf7b Translated using Weblate (Finnish)
Currently translated at 99.9% (8010 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/fi/
2023-05-09 18:49:22 +02:00
Toni Laiho e30c8d8949 Translated using Weblate (Finnish)
Currently translated at 99.9% (8010 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/fi/
2023-05-09 18:49:22 +02:00
Henrik Kauhanen a90c5d71ad Translated using Weblate (Swedish)
Currently translated at 99.9% (8006 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/sv/
2023-05-09 18:49:22 +02:00
Toni Laiho 54f56813a5 Translated using Weblate (Finnish)
Currently translated at 99.9% (8009 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/fi/
2023-05-09 18:49:22 +02:00
Henrik Kauhanen 8d29229c0f Translated using Weblate (Finnish)
Currently translated at 99.9% (8009 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/fi/
2023-05-09 18:49:21 +02:00
Henrik Kauhanen dc498128be Translated using Weblate (Swedish)
Currently translated at 99.9% (8006 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/sv/
2023-05-09 18:49:21 +02:00
Henrik Kauhanen 6d5b71b663 Translated using Weblate (Finnish)
Currently translated at 99.9% (8009 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/fi/
2023-05-09 18:49:21 +02:00
Ulices 122fcbb40b Translated using Weblate (Spanish (Mexico))
Currently translated at 100.0% (8011 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/es_MX/
2023-05-09 18:49:21 +02:00
Ivan Chuba 4fc28bb65e Translated using Weblate (Ukrainian)
Currently translated at 99.9% (8008 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/uk/
2023-05-09 18:49:21 +02:00
turkce a7f92a3187 Translated using Weblate (Turkish)
Currently translated at 47.8% (3832 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/tr/
2023-05-09 18:49:21 +02:00
boonchai k dd16b68623 Translated using Weblate (Thai)
Currently translated at 89.8% (7198 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/th/
2023-05-09 18:49:21 +02:00
Henrik Kauhanen df24d87245 Translated using Weblate (Swedish)
Currently translated at 99.9% (8006 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/sv/
2023-05-09 18:49:20 +02:00
ssantos 6000e04c78 Translated using Weblate (Portuguese)
Currently translated at 99.8% (7999 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/pt/
2023-05-09 18:49:20 +02:00
ZbeeGin 87181a8ecb Translated using Weblate (Polish)
Currently translated at 100.0% (8011 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/pl/
2023-05-09 18:49:20 +02:00
johanneswilkens 7d0731754c Translated using Weblate (Dutch)
Currently translated at 83.8% (6720 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/nl/
2023-05-09 18:49:20 +02:00
Tokita, Hiroshi 962e63ab52 Translated using Weblate (Japanese)
Currently translated at 100.0% (8011 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/ja/
2023-05-09 18:49:20 +02:00
Toni Laiho 9f4b43f3f2 Translated using Weblate (Finnish)
Currently translated at 99.9% (8010 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/fi/
2023-05-09 18:49:20 +02:00
Ettore Atalan ef722200c9 Translated using Weblate (German)
Currently translated at 99.9% (8007 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/de/
2023-05-09 18:49:20 +02:00
Jan Straka 784f47fa86 Translated using Weblate (Czech)
Currently translated at 90.1% (7220 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/cs/
2023-05-09 18:49:20 +02:00
turkce 90cdc28707 Translated using Weblate (Turkish)
Currently translated at 43.9% (3521 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/tr/
2023-05-09 18:49:19 +02:00
turkce 62844b321c Translated using Weblate (Turkish)
Currently translated at 42.4% (3397 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/tr/
2023-05-09 18:49:19 +02:00
Wellington Terumi Uemura 8a6c7f5538 Translated using Weblate (Portuguese (Brazil))
Currently translated at 100.0% (8011 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/pt_BR/
2023-05-09 18:49:19 +02:00
Jeff Young 8c3eeb5201 Support for De Morgan variants in symbol plotting CLI.
(cherry picked from commit 8cd1f8d905)
2023-05-09 13:11:06 +01:00
Jeff Young 5998fabadd Formatting.
(cherry picked from commit 4e420f3cf6)
2023-05-09 13:10:31 +01:00
Jeff Young 97be02356f CLang can't do a dynamic_cast across the KiWay.
Rely on DRC for text readability instead.

(Fixes Sentry KICAD-R4 on Mac, and the assert when opening
Preferences from a non-PCBNew-module window.)

(cherry picked from commit 245c3ba6e4)
2023-05-09 11:15:00 +01:00
Jeff Young e59867d479 Add backspace modifier handling to SCINTILLA_TRICKS.
Fixes https://gitlab.com/kicad/code/kicad/issues/13910
2023-05-08 18:41:13 +01:00
Jeff Young 8e1bcaed37 Holes need a parent.
SetHole() handles all this for us.  Make sure it's called.

Fixes https://gitlab.com/kicad/code/kicad/issues/14702

(cherry picked from commit 5b3798a370)
2023-05-08 14:51:47 +01:00
Jon Evans f3c864c178 PNS: Remove holes when removing items with holes
Related to https://gitlab.com/kicad/code/kicad/-/issues/14702


(cherry picked from commit b06f90335b)
2023-05-08 02:48:55 +00:00
Jeff Young 947923509e Fix a typo.
Fixes https://gitlab.com/kicad/code/kicad/issues/14515

(cherry picked from commit 6059e895d7)
2023-05-08 03:32:32 +03:00
Jeff Young 4e0f77c0f4 Don't allow thickness of 0 in case of an empty stackup.
Fixes https://gitlab.com/kicad/code/kicad/issues/10790
2023-05-07 22:30:01 +01:00
Jeff Young 6f0505f19c Field bounding boxes no longer contain interline spacing.
That's entirely done through FIELD_PADDING now.

Fixes https://gitlab.com/kicad/code/kicad/issues/14127
2023-05-07 22:30:01 +01:00
Marek Roszko 98bf66cb25 Use _fgetc_nolock with msvc
(cherry picked from commit 5dcc221950)
2023-05-07 21:28:59 +00:00
Jon Evans f9b641b24d Allow for settings to be added during load
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14691

(cherry picked from commit 2ab47ee1e9)
2023-05-07 23:48:26 +03:00
jean-pierre charras 3894314ab2 DIALOG_SHIM: fix missing aEvent.Skip() in DIALOG_SHIM::onChildSetFocus().
This method was added in commit a914f6e9.
Missing Skip() created issues on Windows (text edit cursor not shown in dialogs)

Fixes https://gitlab.com/kicad/code/kicad/issues/14692

(cherry picked from commit e208685f85)
2023-05-07 19:16:41 +03:00
Marek Roszko edc9d38680 Change the spacemouse driver flag to true for windows by default
(cherry picked from commit b92f62337f)
2023-05-07 16:12:57 +00:00
Seth Hillbrand ce5f72207e Cleanup printf bits
(cherry picked from commit 990641d2eb)
2023-05-07 19:02:02 +03:00
Marek Roszko ff8d009022 Add missing footprint load progress, usually in schematic editor
(cherry picked from commit c7eaef2d13)
2023-05-07 15:17:27 +00:00
Jeff Young 589c33ec05 Fix capitalization of text vars for Eagle importer.
Also fixes the test gold files to expect the correct variable
references.

(cherry picked from commit 8bd21edd8a)
2023-05-06 23:53:18 +01:00
Jeff Young 28fe5b0df5 Expand solder mask for pads *defined* to be on copper layers.
Fixes https://gitlab.com/kicad/code/kicad/issues/14693
2023-05-06 21:29:18 +01:00
Jeff Young 5a3dfe598f Handle Eagle user-defined attributes.
(We map these to text variables.)

Fixes https://gitlab.com/kicad/code/kicad/issues/13798

(cherry picked from commit 8fe02ee83c)
2023-05-06 21:11:16 +01:00
Jeff Young d0c132ccd4 Defense in depth for "mouse stuck in canvas".
Fixes https://gitlab.com/kicad/code/kicad/issues/12653

(cherry picked from commit 49655ae742)
2023-05-06 11:29:05 +01:00
Jeff Young 826541548c Make sure mouse isn't captured when dialog is raised.
Fixes https://gitlab.com/kicad/code/kicad/issues/14685

(cherry picked from commit c016bea020)
2023-05-06 11:29:01 +01:00
Jeff Young e3adc76a72 Rewrite linebreaking algorithm.
Previous version was overly simplistic to deal correctly
with multiple spaces or textruns not separated by spaces.

Fixes https://gitlab.com/kicad/code/kicad/issues/14683
2023-05-05 22:32:03 +01:00
Wayne Stambaugh 2ae2d7ee1a Verify parent symbol shared pointer is still valid in symbol editor.
(cherry picked from commit 51fd7ca5ed)
2023-05-05 13:50:06 -04:00
Jeff Young e28b50e8d6 Fix a bunch more issues with sheetpaths and allowExtraText.
A sheetpath is required to correctly resolve text variables.
Depending on currentSheet is rife with bugs.

There are many places where we do *not* want to be prepending
field names to the field values, such as netlisting,
building PDF hypertext menus, etc.

Also, Find/Replace needs to work on unresolved text, as
that's what we're going to display (and if replace nuked
your variable references you wouldn't be happy).

(cherry picked from commit b41d446f58)
2023-05-05 18:02:59 +01:00
Wayne Stambaugh 9c78d86f58 Don't include power symbol pin when exporting netlist.
The netlist exporter was never updated to exclude symbols that are
tagged as power symbols.  Only the legacy power symbol name prefix
('#') was used as the power symbol check.  Power symbols no longer
require the '#' name prefix.

(cherry picked from commit fb6b8eaeea)
2023-05-05 11:36:39 -04:00
Marek Roszko a6b23a751e Add env var to force logging on msw
(cherry picked from commit 18dd623122)
2023-05-05 00:59:41 +00:00
Seth Hillbrand 34d5f1f9fe Fix a28d590b9b
Needs to be static, so keep the reference from the associated symbol and
not the SCH_SYMBOL instance.  Both will likely have the same prefix,
which is all we care about here

(cherry picked from commit 2cac992801)
2023-05-04 15:53:15 -04:00
Seth Hillbrand 43ad15dc0e Force not-on-board symbols to NONE priority
Symbols that are not on the board should not affect the arbitrary names
assigned to unlabeled nets.

(cherry picked from commit a28d590b9b)
2023-05-04 15:52:57 -04:00
Jeff Young d20147c79f Use correct sheetpath when exporting netlist.
(cherry picked from commit c20ef06f56)
2023-05-04 14:28:40 +01:00
Jeff Young 7cc014cf9e Be careful of infobar outliving symbol.
Fixes https://gitlab.com/kicad/code/kicad/issues/14680
2023-05-04 11:52:02 +01:00
Jeff Young 9e735fc940 First <ESC> after an edit in a textEdit cancels the edit.
(Second will exit the dialog.)

Fixes https://gitlab.com/kicad/code/kicad/issues/14514

(cherry picked from commit a914f6e992)
2023-05-04 11:52:02 +01:00
Jeff Young 4fecf6c50d Add select-all to TEXT_ENTRY_TRICKS.
Fixes https://gitlab.com/kicad/code/kicad/issues/14237

Fixes https://gitlab.com/kicad/code/kicad/issues/13304

(cherry picked from commit 9252793fdb)
2023-05-04 11:52:02 +01:00
Jeff Young c31c14e46b Don't call BuildInitialTrace() for entry gateways.
We're going to call it to connect the entry and target gateways
anyway, so all we need are gateways at 22.5 degrees to setup entry
at +/- 45 degrees from the current direction.

Fixes https://gitlab.com/kicad/code/kicad/issues/14324

Fixes https://gitlab.com/kicad/code/kicad/issues/12459

(cherry picked from commit 507a25f150)
2023-05-04 11:52:02 +01:00
jean-pierre charras 349dbb98a6 bom_csv_grouped_by_value_with_fp.py: fix compatibility with python < 3.9
From master branch
2023-05-04 08:54:55 +02:00
Jeff Young f4fa5bb0fc Don't store resolved values in symbol fields table editor dataStore.
We're going to use the dataStore to update the symbol, so
if we store resolved values it will nuke any text variables
even if the field wasn't edited.

Not sure if the BOM generator has a separate resolve-variables
step or not.  But it will need one as the code removed here
only worked for Values and Footprint fields anyway.
2023-05-04 00:08:18 +01:00
Seth Hillbrand 4cdf75dc72 Remove matching parents/neighbors in subgraphs
This ensures that when bus elements or labels matching bus elements are
removed that the stale neighbor/parent references are similarly removed
2023-05-03 13:35:51 -07:00
Seth Hillbrand 53eb39e033 Avoid NaNs when applying fillets
Segments that are inline with each other will create NaNs when
filleting.  This double check prevents NaN points from being added to
the polygon

(cherry picked from commit b72c6e5cb0)
2023-05-03 11:50:47 -07:00
Mark Roszko 57ae43890c Update 5 files
- /eeschema/CMakeLists.txt
- /eeschema/eeschema.cpp
- /pcbnew/pcbnew.cpp
- /qa/qa_utils/pcb_test_frame.cpp
- /qa/unittests/eeschema/test_module.cpp
2023-05-03 17:32:55 +00:00
jean-pierre charras 1c59574cbf FOOTPRINT_EDIT_FRAME: do not delete settings when closing the frame.
They now are read when starting kicad, and must be not deleted.


(cherry picked from commit 0c544f1f45)
2023-05-03 17:27:28 +00:00
Seth Hillbrand 7ddef03aba Initialize settings for SINGLE_TOP
(cherry picked from commit 82ba67db82)
2023-05-03 17:26:57 +00:00
Seth Hillbrand 4258738b89 Remove extraneous symbol editor settings
(cherry picked from commit 2cd861dbd5)
2023-05-03 17:26:26 +00:00
Seth Hillbrand 594864e117 Remove extraneous includes
(cherry picked from commit 892e4536b0)
2023-05-03 17:26:13 +00:00
Seth Hillbrand a5698ce480 Remove locks from settings
Settings should be initialized on start-up.  This removes the option of
lazily loading the settings from file and instead requires all settings
needed to be loaded on KiFACE start before requesting data from the
settings object


(cherry picked from commit e6ab9a88ce)
2023-05-03 17:25:17 +00:00
Seth Hillbrand 1a2c9011e6 Rework Copper Sliver check
Adds QA checks to copper sliver tests.  Adds the following checks:
- Dot product between two arms (quickly avoids checks for >90°)
- Checks the sliver is convex (area test)
- Eliminates minor slivers with angles that are approximately 0 and ones
  with the opposite side width beneath a configurable level
- Updates Clipper2 to fix a couple of jagged edges on inflate
- Adds simplify during zone fill inflation to limit jaggies

Fixes https://gitlab.com/kicad/code/kicad/issues/14549

(cherry picked from commit f7f52d77e4)
2023-05-03 10:22:49 -07:00
Jeff Young 600ac72a3d Add missing property to footprint texts table.
Fixes https://gitlab.com/kicad/code/kicad/issues/14357
2023-05-03 17:58:29 +01:00
jean-pierre charras 1118eed080 Use operator at() instead of [] to access a std::array item
It helps debug.
From Master branch
2023-05-03 17:21:36 +02:00
jean-pierre charras e42c66bd0e Pcbnew: fix crash when loading a file having vias on connected layers only.
It was due to an access out of bounds in a std::array
Fixes #14668
https://gitlab.com/kicad/code/kicad/issues/14668
2023-05-03 17:18:28 +02:00
Jeff Young ff8fae377c Pass aEvent by value.
It will have changed by the time CallAfter() is executed.

Fixes https://gitlab.com/kicad/code/kicad/issues/12475
2023-05-03 12:27:45 +01:00
Jeff Young 6931252ed9 Pull back more sheetPath fixes from master. 2023-05-03 12:04:46 +01:00
Mike Williams ef8e549d86 PCB Search Pane: show Board Setup / Net Classes on net activation
(cherry picked from commit bc8f81b14d)
2023-05-03 11:55:50 +01:00
Mike Williams a5470029a8 PCB Search Pane: activate item opens properties dialog
Fixes: https://gitlab.com/kicad/code/kicad/-/issues/12475
(cherry picked from commit 71b687622b)
2023-05-03 11:55:14 +01:00
Mike Williams 13fb23d59d Search Pane: add Activation (enter/double click) event support
(cherry picked from commit d915cb780e)
2023-05-03 11:54:49 +01:00
Jeff Young a3197578d6 Tighten lifecycle management of CN_ANCHOR/CN_ITEM.
In particular, when a CN_ITEM is freed set all its anchor's
item pointers to NULL.  (The anchors have a separate
lifecycle due to being std::shared_ptrs.)

Hopefully fixes Sentry KICAD-KV.

(cherry picked from commit 0eac5c6748)
2023-05-03 10:51:20 +01:00
Jeff Young ebc14b35f5 Commenting and formatting. 2023-05-02 14:14:05 +01:00
jean-pierre charras b0235a2805 3D viewer: use the right color theme (the one used in the board editor)
From Master branch
Fixes #14616
https://gitlab.com/kicad/code/kicad/issues/14616
2023-05-01 17:00:09 +02:00
jean-pierre charras d0069e0e1d specctra_export: fix unit conv PCB iu -> DSN
From Master branch, commit 28028c941e
Fixes #14656
https://gitlab.com/kicad/code/kicad/issues/14656
2023-04-30 20:58:12 +02:00
Jeff Young 878f136951 Extend Mac colour picker cursor fix to GTK.
(cherry picked from commit a3b741a126)
2023-04-30 18:12:04 +01:00
Jeff Young bf364bf74c Go back to winner-takes-all lib-tree scoring algorithm.
(Because we sort alphabetically there's no way to see
what the second-highest scored item was.)
2023-04-30 12:32:19 +01:00
Jeff Young 03c2850c59 Record parent rule for DRC assertions.
(Particularly important if the rule specified a severity.)

Also fixes a bug looking up LSET layer names in the
GetStandardLayerNames array (which aren't the same).

https://forum.kicad.info/t/a-few-questions-about-custom-rules-syntax/40068/7
2023-04-29 21:17:56 +01:00
Jeff Young 4eddc7131d Add Grid Settings to PL_EDITOR.
Fixes https://gitlab.com/kicad/code/kicad/issues/14612
2023-04-29 18:16:51 +01:00
Jeff Young 14be1935e8 Formatting and cleanup. 2023-04-29 18:14:24 +01:00
Jeff Young f08029354a Use wxFileName to resolve . and .. in documentation paths.
Fixes https://gitlab.com/kicad/code/kicad/issues/14564

(cherry picked from commit 08c773a0bf)
2023-04-29 17:52:54 +01:00
Jeff Young c18600b67f Don't reset alpha when specified in hex value.
Also fixes a bug with colour picker cursor drawing on Mac.

Fixes https://gitlab.com/kicad/code/kicad/issues/14646

(cherry picked from commit a817b4c1ff)
2023-04-29 17:52:50 +01:00
Jeff Young 2acc0a6844 Use Net() accessor uniformly; init hole parent in VIA::Clone()
Fixes https://gitlab.com/kicad/code/kicad/issues/14603

(cherry picked from commit 16e000f2b0)
2023-04-28 18:33:27 +01:00
Lucas Dumont 8ffba3a52f Update collide for hole
As hole don't keep track of the net, update the collide function to keep it working

(cherry picked from commit b1a4353c34)
2023-04-28 16:20:31 +01:00
Jeff Young 0fb2f35b10 Fix sheetPath handling in SPICE model generation.
(cherry picked from commit d5cb100f72)
2023-04-28 16:20:03 +01:00
Jeff Young f8270b9cec Tighten ownership model of PNS::ITEM.
In particular, ownership must be explicitly set.  It is
no longer inherited through copy/clone/etc.
2023-04-28 11:03:24 +01:00
Jeff Young d3311ee231 Implement better sheet-path awareness for label text var resolution.
(cherry picked from commit 4b0027a5d7)
2023-04-28 01:02:58 +01:00
Jeff Young 21eb2c8dad Simplify PNS::VIA construction.
(cherry picked from commit 9646e3c1c0)
2023-04-28 00:33:27 +01:00
Jeff Young a11fd7a792 Set currentSheet when exporting netlist.
Patch courtesy of Fernando Gomez.

(cherry picked from commit 5e21e94478)
2023-04-26 18:20:34 +01:00
Seth Hillbrand a2ad9f8b10 Handle multiple holes in footprints
Our basic logic for whether we have a hole or an outline in a footprint
checks if there is copper pads outside of the closed edge.  This misses
the case where the footprint is used to align multiple holes but has no
copper.  Since we do not support multiple outlines in a board, we can
safely assume that multiple, closed edges in a footprint represent holes
and not outlines

Fixes https://gitlab.com/kicad/code/kicad/issues/14468

(cherry picked from commit 4b91c0c8ee)
2023-04-26 09:37:08 -07:00
Lucas Dumont 9a0e2f3395 Fix typo in QueryConstraint switch
(cherry picked from commit 2992d7c68b)
2023-04-26 14:21:38 +01:00
Jeff Young cd9196ddb9 Use fileds from flattened lib symbol when updating.
Fixes https://gitlab.com/kicad/code/kicad/issues/14577

(cherry picked from commit d816fb071f)
2023-04-26 13:04:05 +01:00
Jeff Young c10fe673a2 Don't let add-row processing intercept OK processing.
Fixes https://gitlab.com/kicad/code/kicad/issues/14579

(cherry picked from commit 5b56cb6bdb)
2023-04-26 13:04:05 +01:00
Wayne Stambaugh 105f8a1720 Do not close ERC dialog when first error is on a different sheet.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14538
2023-04-26 07:51:32 -04:00
Seth Hillbrand 050f47daf1 Bug Fixes for new incremental connectivity
- Ensure that critical paths (ERC/netlister) are fully-rechecked
- Handle symbol/pin distinction in change markers
- Fully connect hierarchical pins in one pass descending

(cherry picked from commit 6e8a5acc66)
2023-04-25 11:32:59 -07:00
Seth Hillbrand 683abd2029 Add ability to update subgraphs based on changeset
Previously, almost all connectivity updates were full updates, meaning
that the entire connectivity graph would be rebuilt each time a change
was made to the schematic.  This update modifies the update to only
correct the subgraphs that are directly affected by the change.

It uses the existing connection graph to find all affected subgraphs as
well as connections to the changes based on the visible schematic.
These elements are removed from the existing connectivity graph and
marked dirty.  They then have a new connectivity graph built only around
their changes.  The resulting graph is merged into the original.

Currently, this ability is behind an advanced config flag
`IncrementalConnectivity` while testing.

Fixes https://gitlab.com/kicad/code/kicad/issues/10846

Fixes https://gitlab.com/kicad/code/kicad/issues/1794

(cherry picked from commit a154571438)
2023-04-25 11:32:04 -07:00
Seth Hillbrand d08f937932 Move Spacemouse to advanced config
The spacemouse driver, particularly on Mac, is extremely unstable and
causes crashes even when not being used.  This places the interface
behind an advanced config flag to ensure that users can affirmatively
opt-in to the potential for crashes

(cherry picked from commit 2cd854af14)
2023-04-25 11:30:36 -07:00
jean-pierre charras 2f51742311 netlist exporter: export only the field value, even if field name is shown.
Previously, when the field name was visible, the exported field value was
prefixed by the field name, and this is incorrect.
From master branch
Fixes #14611
https://gitlab.com/kicad/code/kicad/issues/14611
2023-04-25 15:17:05 +02:00
Lucas Dumont b926d2f0bd Don't override clearance when routing
The default `m_overrideClearance = -1` used here was changed to 1.
Reseting it to -1 to solve linked issue

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14595

(cherry picked from commit e2e901de1d)
2023-04-25 10:21:13 +01:00
Jeff Young 89d1d36e79 Don't try to keep track of a HOLE's net.
Keep track of it's parentPadVia instead.

Fixes https://gitlab.com/kicad/code/kicad/issues/14603

(cherry picked from commit 676a15df65)
2023-04-24 18:32:48 +01:00
Jeff Young 999cd8cd11 Simulator fixes.
1) Don't read libraries multiple times
2) VDMOS default is nchan if not specified
3) In the absence of a workbook default to LTSpice compatability
4) Don't attempt to write out a model line for a subckt; it never has
a baseModel
2023-04-24 13:55:34 +01:00
Jeff Young fd8b281731 Formatting. 2023-04-24 13:55:15 +01:00
Jeff Young d8481b4528 More robust file reading for simulator files. 2023-04-24 13:53:22 +01:00
jean-pierre charras 6d93fa046c pcb_calculator: add missing code to save Regulator Panel settings.
From master branch.
2023-04-24 09:14:31 +02:00
jean-pierre charras c75672fd44 OPENGL_GAL: draw BITMAP_BASE: fix incorrect rendering of mirrored bitmaps
The vertical mirror was not working.
2023-04-23 16:12:14 +02:00
jean-pierre charras 5484796745 BITMAP_BASE::Mirror() and ::Rotate(): fix an issue for bitmaps with ppi not 300
wxImage::Mirror() and wxImage::Rotate() transforms clear some parameters, especially
the PPI stored in the image. It creates bad size (bad ppi) when saving a BITMAP_BASE
in files.
These parameters are now restored after transform.
2023-04-23 16:12:14 +02:00
Marek Roszko 4ed45e0515 Fix gerbers and drill plot not logging errors
Partial fix for https://gitlab.com/kicad/code/kicad/-/issues/14437


(cherry picked from commit dbed94e4b1)
2023-04-21 03:40:28 +00:00
Marek Roszko 9956c04526 Load custom drawing sheets for pcb cli
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14171


(cherry picked from commit 9f64c7f354)
2023-04-21 03:18:27 +00:00
jean-pierre charras b74af71312 * Eeschema: save worksheet filename in project file.
The call to saveProjectSettings() was missing.
From master branch, commit b96f3d085c
Fixes #14219
https://gitlab.com/kicad/code/kicad/issues/14219
Fix also a minor compil warning
2023-04-20 09:22:33 +02:00
Jeff Young 44640422f2 Copy RC_ITEM fix to ERC_ITEM (where it's actually needed).
Fixes https://gitlab.com/kicad/code/kicad/issues/14569
2023-04-19 14:08:55 +01:00
Jeff Young be91f378ac Suppress newlines in RC_ITEM messages.
Fixes https://gitlab.com/kicad/code/kicad/issues/14569
2023-04-19 12:38:46 +01:00
Jeff Young bdca18cc9f Ensure item is gridded if there was no motion between clicks.
(cherry picked from commit f7a552a2b3)
2023-04-18 23:56:17 +01:00
Jeff Young 76cb15f545 Trim VRML export layers to board outline.
Fixes https://gitlab.com/kicad/code/kicad/issues/14557
2023-04-18 16:47:42 +01:00
Jeff Young 4f9e754a51 Ignore empty field-name-templates.
Fixes https://gitlab.com/kicad/code/kicad/issues/14552
2023-04-18 13:46:08 +01:00
Jeff Young 955774a91a Amend overly aggressive assert. 2023-04-17 17:52:28 +01:00
Jeff Young e8a9485d5e Markup fixes.
1) allow escape sequences inside markup sequences
2) keep overbar when inside nested markup
3) always place overbar at full height, not sub/superscript height

Fixes https://gitlab.com/kicad/code/kicad/issues/14553

Fixes https://gitlab.com/kicad/code/kicad/issues/13449
2023-04-17 17:52:11 +01:00
Lucas Dumont 0736c141b9 pcbnew: Fix crash with differential routing
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14537

(cherry picked from commit 469fe76994)
2023-04-17 09:48:18 +01:00
Jeff Young 204549f55b Fix merge error. 2023-04-16 23:22:49 +01:00
Jeff Young 82a5f307ed Pull fix back from master. 2023-04-16 23:06:36 +01:00
Jeff Young 7a4650a1a9 Double double-add items to the view.
(cherry picked from commit a540c01c61)
2023-04-16 23:05:24 +01:00
Jeff Young 518980d9ed Small improvements to lifecycle safety.
Fixes https://gitlab.com/kicad/code/kicad/issues/14521

Fixes https://gitlab.com/kicad/code/kicad/issues/14315

(cherry picked from commit cc4a8dcc89)
2023-04-16 18:49:53 +01:00
Jeff Young 5cc1e2e42d The symbol viewer handles its own message panel.
(cherry picked from commit 6fb8916798)
2023-04-16 18:49:53 +01:00
jean-pierre charras c599385c8b footprint wizards: fixes and enhancements
From master branch
2023-04-16 17:32:31 +02:00
Jeff Young 1d37d3fdf7 Performance.
(cherry picked from commit 2793bb1d68)
2023-04-16 15:38:32 +01:00
Jeff Young f3db64af05 Multi-threading safety.
(Possible fix for KICAD-74.)

(cherry picked from commit b76ef8c7e2)
2023-04-16 15:38:22 +01:00
Jeff Young 3217372720 Tighten up the lifecycle management of VIEW_ITEMs in
general, and the SYMBOL_VIEWER_FRAME's m_previewItem in
particular.

(Attempted fix for Sentry KICAD-G1.)

(cherry picked from commit 6f59740953)
2023-04-16 15:38:15 +01:00
Jeff Young 7a50654f3b Export rectangular aperture GBR_SEGMENTS as polygons.
Fixes https://gitlab.com/kicad/code/kicad/issues/14136
2023-04-15 22:31:49 +01:00
Jeff Young 9893921d76 Handle legacy libraries with escaped symbol names.
Fixes https://gitlab.com/kicad/code/kicad/issues/14057

(cherry picked from commit b74d964bff)
2023-04-15 22:31:49 +01:00
Jeff Young 5574f35473 Apply symbol attributes from base symbol, not derived symbol.
Fixes https://gitlab.com/kicad/code/kicad/issues/13740

(cherry picked from commit d4b4abd001)
2023-04-15 22:31:49 +01:00
Alex fd42e493c0 Don't crash when canceling initial setup in Manage Footprint Libraries
(cherry picked from commit 21103924f4)
2023-04-15 16:25:12 +00:00
jean-pierre charras 7843e6a709 Python: re-add "def Duplicate(self)" with the correct call to C++ Duplicate().
From master branch.
2023-04-15 16:20:42 +02:00
Marek Roszko 4c129ec208 Init curl in InitPgm for thread safety
curl itself highly recommends not initializing curl from within a thread.
Due to the PCM, this can happen in a thread these days.

Pointed out by Érico Rolim in https://gitlab.com/kicad/code/kicad/-/merge_requests/855


(cherry picked from commit 8fd4909f86)
2023-04-15 13:19:32 +00:00
Jeff Young 1bf44561da Allow setting 0 to min width, min track width, min via annular width, etc.
Fixes https://gitlab.com/kicad/code/kicad/issues/13822

(cherry picked from commit 299c88cfec)
2023-04-15 13:22:52 +01:00
Jeff Young ad612864ce Update DRC exclusions model to match terminology.
DRC exclusions were originally written following the C++
pragma model (ie: allow this violation here).  However, the
"exclusion" terminology we used in the GUI suggests a model
model where the exclusions go away when the violation no
longer exists.

Fixes https://gitlab.com/kicad/code/kicad/issues/14351
2023-04-15 12:10:23 +01:00
Jeff Young 1707436cad Retire the lib-tree scoring algorithm.
It appears to cause more confusion than help.

Fixes https://gitlab.com/kicad/code/kicad/issues/13905

(cherry picked from commit d01c023d5a)
2023-04-15 00:09:34 +01:00
Jeff Young b011d508f8 Clear board soldermask when undoing/redoing items that affect it.
Fixes https://gitlab.com/kicad/code/kicad/issues/13446

(cherry picked from commit 4a3f77cd9d)
2023-04-15 00:08:14 +01:00
Jeff Young f67a477f65 Pull some fixes from master. 2023-04-14 19:55:31 +01:00
Jeff Young 3573b97bfc Save library when it's selected in lib tree.
Fixes https://gitlab.com/kicad/code/kicad/issues/14220

(cherry picked from commit 05185ec81a)
2023-04-14 17:36:10 +01:00
jean-pierre charras 37a42a3fb7 ERC: set default setting ERCE_SIMULATION_MODEL to ignore
Most of projects do not manage spice settings.
From master branch
2023-04-14 17:29:42 +02:00
Jeff Young 2d13ddc70c Fix PNS_KICAD_IFACE_BASE::IsFlashedOnLayer() to be able to handle multi-layer queries. 2023-04-14 10:59:10 +01:00
Jeff Young 0be01f3c24 Don't steal an existing via's hole.
(cherry picked from commit 6fb30398ca)
2023-04-14 10:09:03 +01:00
Jeff Young eb492724c7 Further simplify PNS::ITEM::collideSimple().
Also brings text_pns_basic's mocks into line with their "real"
counterparts.

(cherry picked from commit 2f198bdcb2)
2023-04-14 10:09:03 +01:00
Jeff Young 3b05d03220 Add PNS::ITEM::BoardItem() call.
About 1/3 of callers to Parent() don't care if they get the immediate
parent or not, about 1/3 want only the immediate parent, and about 1/3
want the hole parent's Parent().

I had earlier changed PNS::ITEM::HOLE to override Parent() and return
the hole parent's Parent(), but since the callers are pretty evenly
split I've reverted that and added BoardItem() for callers who want the
eventual BOARD_ITEM (whether a direct parent or a grandparent).

(Also removes a dead routine so I didn't have to figure out which of
the two it wanted....)

(cherry picked from commit 6f0d963683)
2023-04-14 10:09:03 +01:00
Jeff Young 4c04233a20 Unify most special-case processing to the clearance if-then-else.
This also allows us to support hole-to-hole clearance when dragging
a via near another via on the same net.

Fixes https://gitlab.com/kicad/code/kicad/issues/12781

(cherry picked from commit 8a0c225efa)
2023-04-14 00:10:48 +01:00
Jeff Young 2b6d2fc117 Don't return holes that have a parent pad or via.
(While we don't currently have holes without a parent pad or via, you
could imagine using HOLEs in the future to represent a hole in a first-class
board outline, so better not to build this assumption in.)

(cherry picked from commit b18bf09208)
2023-04-14 00:10:43 +01:00
Jeff Young f64ef39687 Post-merge cleanup of holes-as-first-class-citizens.
(cherry picked from commit 4cc289c6fb)
2023-04-14 00:10:34 +01:00
Tomasz Wlostowski c1fb392333 router: hole as first-class-object, initial version of rewritten collision check routine
Rebased and modified by Jeff Young <jeff@rokeby.ie> 6 April 2023

(cherry picked from commit 1532a83330)
2023-04-14 00:10:07 +01:00
Tomasz Wlostowski de60d5467c router: further changes to the ownership model
- LINEs now own their vias optionally (depending whether a LINE with its VIA belongs to a node)
- get rid of unique_ptr on the internal NODE::Add API (and also made it private)
- make sure stack pointers are not added to the node
- use rvalue reference for NODE::Add/NODE::Replace

Manually rebased by Jeff Young <jeff@rokeby.ie> 5 April 2023

(cherry picked from commit d961cdce3f)
2023-04-14 00:10:01 +01:00
Tomasz Wlostowski c1274e24b0 router: hole as first class objects, wip
Rebased by Jeff Young <jeff@rokeby.ie> 5 April 2023

(Also includes a bug-fix for highlighting collisions with edge-cut
items.)

(cherry picked from commit bfbda978b8)
2023-04-14 00:09:56 +01:00
Tomasz Wlostowski 7f593d3999 router: rework ITEM ownership model.
- prerequisite for holes as first class objects code
- introduced the OWNABLE_ITEM interface that defines the owning container (NODE/other ITEM/ITEM_SET)
- simplified the ITEM_SET interface
- constified a lot of APIs (ownership/JOINT management) as a side effect

Rebased and cleaned up by Jeff Young <jeff@rokeby.ie> 5 April 2023
- some STL cover types removed

(cherry picked from commit 1283c4713f)
2023-04-14 00:09:49 +01:00
Tomasz Wlostowski 3a6a6097a7 router: pass collision query options in a structure
Selectively cherry-picked by Jeff Young <jeff@rokeby.ie> 4 April 2023
- Jon's user-clearance-epsilon algo kept intact
- Jeff's castellated-pad code kept intact

(cherry picked from commit eed05191a9)
2023-04-14 00:07:47 +01:00
Marek Roszko 69989e4e64 Fix build error pre wx 3.1.6
(cherry picked from commit 0eefde6046)
2023-04-13 22:21:35 +00:00
Wayne Stambaugh 88999b34d3 Begin version 7.0.3 development. 2023-04-13 16:29:47 -04:00
Wayne Stambaugh 582732918d Tag release version 7.0.2. 2023-04-13 16:27:39 -04:00
Lucas Dumont f1f69c607e Check KiFACE return value
Avoid segfault when cancelling initial global library setup

(Cherry-picked from 3c24017aa4)
2023-04-13 14:39:49 +01:00
Jeff Young 8e82fee494 Attempt to fix gcc compile error. 2023-04-13 13:57:14 +01:00
Jeff Young a51475a094 Performance improvement for GetShownColumns.
(This needs to be fast as it's called from OnUpdateUI events.)

(cherry picked from commit 8e29a054f3)
2023-04-13 13:47:21 +01:00
Jeff Young f25e2d48bd Search in label fields.
Fixes https://gitlab.com/kicad/code/kicad/issues/14075

(cherry picked from commit a24a63e416)
2023-04-13 10:59:39 +01:00
jean-pierre charras 2bbff64a12 Fix compatibility of QA golden files with 7.0x version 2023-04-13 08:01:32 +02:00
Seth Hillbrand 70b4503187 Fix cherry-pick errors 2023-04-13 02:11:39 +02:00
Jeff Young 912bd4458f Don't trip over a uniquified-name in the schematic library-symbol cache.
Fixes https://gitlab.com/kicad/code/kicad/issues/14160
2023-04-12 18:35:27 +01:00
Ian McInerney d3f4494925 Make version info work without lsb-release installed
(Cherry-picked from 8351c8923a)
2023-04-12 16:13:51 +01:00
Ian McInerney 464467ae8b Fix nanodbc build with clang and gcc stdlib
This should really be fixed upstream somehow, but the upstream build
with clang is broken on Fedora 38 right now anyway due to header issues.

(Cherry-picked from 45b8dced92)
2023-04-12 16:10:20 +01:00
Ian McInerney 8e579ec8e0 Remove python-based board_item duplicate method
This method shadows the C++ method, and doesn't properly handle updating
the duplicated object's KIID to be unique.

Also add tests to ensure the KIIDs are unique after duplication.

Fixes https://gitlab.com/kicad/code/kicad/issues/14460

(Cherry-picked from 5d0b5e16ff)
2023-04-12 16:07:00 +01:00
Ian McInerney 4ef6cbf4fb Add hack to speed up font choice box widget creation
There are problems internal to GTK that mean creating choice boxes with
a lot of items is a very slow process. This hack works around one of
those issues to make it faster to create and display the menu in the
choice box.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14277

(Cherry-picked from a77e94d16f)
2023-04-12 15:24:25 +01:00
Seth Hillbrand 68dfcddbe9 Allow bus elements to connect
Previously, bus elements that were not instantiated as individual nets
could not connect to each other.  This caused issues for complex
schematics where busses needed to connect to other busses with elements
that resolved to the same net names.  Functionally, this means mixing
bus elements, which we will replace with first-class elements in version
8 but currently can only be accomplished either by using bus aliases and
  this patch or by individually instantiating each bus element as a
local label

Fixes https://gitlab.com/kicad/code/kicad/issues/14300

(cherry picked from commit 16b4ec3c7e)
2023-04-12 16:10:50 +02:00
jean-pierre charras 907761f14e SCH_LABEL_BASE::SetPosition(): ensure field positions are also handled.
Fixes #14520
https://gitlab.com/kicad/code/kicad/issues/14520
2023-04-12 11:20:41 +02:00
jean-pierre charras be7917c8d8 LIB_TABLE_GRID_TRICKS, popup context menu: fix minor issues:
- add separator only if needed
- ensure selection parameters are up to date.
From master branch
2023-04-12 11:20:11 +02:00
jean-pierre charras 2e25f09ae4 French translation update 2023-04-12 09:47:43 +02:00
jean-pierre charras ea95d8604a Ensure we do not use a non existing pin in SIM_MODEL::MigrateSimModel()
From master branch
Fixes #14522
https://gitlab.com/kicad/code/kicad/issues/14522
2023-04-12 09:41:07 +02:00
Marek Roszko 35def3ab2e Prevent VIEW::UpdateItems and onShowTimer from firing repaints if GAL did not complete init
This appears to be a possible event race on startup

Fixes sentry KICAD-10A


(cherry picked from commit bfad8bb0d5)
2023-04-12 02:10:34 +00:00
Marek Roszko 5527c12a8d Fix crash due to extra right parens in pcad files
Fixes sentry KICAD-TA


(cherry picked from commit 37eaa29679)
2023-04-12 01:53:29 +00:00
Mark Roszko fb1cc72013 Don't crash on empty pcad polygons
Fixes sentry KICAD-103
2023-04-12 01:41:06 +00:00
Jeff Young 1f34883a27 Make symbol/footprint trees sensitive to language change.
(cherry picked from commit eef3492fc0)
2023-04-12 00:01:58 +01:00
jean-pierre charras 724262651f manage libraries dialog: show new state of widgets as soon as the context-menu
activate/deactivate changes their state
From master branch
Fixes #14517
https://gitlab.com/kicad/code/kicad/issues/14517
2023-04-11 18:55:51 +02:00
Alex d7b2247878 opengl_gal: Remove extra padding of bitmap textures.
Since the format has been changed to RGBA8, default (UN)PACK_ALIGNMENT = 4
works correctly, so the texture width padding to 4 is not needed anymore.

Fixes https://gitlab.com/kicad/code/kicad/issues/14432


(cherry picked from commit e91b53fc39)
2023-04-11 04:32:42 +00:00
jean-pierre charras 372e7b6312 fix 2 issues related to SCH_GLOBALLABEL items:
- Ensure the first field in m_fields has id = 0 to be seen has hypertext
(it was not the case after reading a .kicad_sch file)
- when converting this item to another label/text, remove this special Field
from the copied field list to the converted label.
From master branch.
2023-04-10 10:02:50 +02:00
Jeff Young 323a2d83fa Ease acquisition of a target item.
pickSingleItem() had a two-attempt algorithm, but the second attempt
was never made because we'd check for no hits before throwing out the
aAvoidItems.

The second attempt would fail anyway because QueryHoverItems() ignored
the aUseClearance flag when not idle, and didn't factor in the actual
clearance.

(cherry picked from commit d040690f60)
2023-04-09 23:13:44 +01:00
Jeff Young 03c3393616 Handle more pad shapes when building diffpair gateways.
Fixes https://gitlab.com/kicad/code/kicad/issues/1883

(cherry picked from commit 1d19672054)
2023-04-09 23:07:38 +01:00
Jeff Young cbff011e3c Don't delete default intersheetrefs field from global labels.
Fixes https://gitlab.com/kicad/code/kicad/issues/14493

(cherry picked from commit a226f7fc14)
2023-04-09 19:04:33 +01:00
Jeff Young 2ba6fad633 Centralize NPTH has-annulus processing.
Fixes https://gitlab.com/kicad/code/kicad/issues/13437

(cherry picked from commit 3b63d70d01)
2023-04-09 19:04:33 +01:00
Mark Roszko bc4878d71e Update ngspice to 40 in vcpkg 2023-04-09 02:16:09 +00:00
jean-pierre charras e991ae504b DIALOG_IMAGE_PROPERTIES: fix some issues:
- add missing panel_image_properties_base.fpb file
- fix not displayed image.
From master branch
2023-04-08 17:04:02 +02:00
Seth Hillbrand c18181042f Simplify test for substantial nubs
Substantial elements following a divot should be at least as far in each
cardinal direction from the origin point in order to be considered
substantial.  This catches cases where the "substantial" element is
actually a straight segment away from the divot

Fixes https://gitlab.com/kicad/code/kicad/issues/14130

(cherry picked from commit 914b5a4d21)
2023-04-07 16:41:11 -07:00
jean-pierre charras 3de80d3b20 Plot gerber: fix a too zealous plot of negative objects on the silkscreen layers,
when merging layers to silkscreen layers.
From master branch
2023-04-07 11:34:42 +02:00
Seth Hillbrand 39dcd0a352 Handle nested netclass assignments
Netclass directives should not be overriden, instead hold our error
checking for actually missing nets

Fixes https://gitlab.com/kicad/code/kicad/issues/14494

(cherry picked from commit 012737593b)
2023-04-06 17:38:42 -07:00
Jeff Young 199e31ea3f Eagle template footprints don't actually belong to board.
Set their parent to nullptr before deleting (as the board may have
already been deleted).

Likely fix for Sentry KICAD-79.

(cherry picked from commit 13e79af8a0)
2023-04-04 14:21:19 +01:00
Jeff Young dce2247925 Improve scoping control of connetion members.
(The real bug here is that CONNECTION_GRAPH::assignNetCodesToBus() was
growing the bus aliases members list because it used a non-const
reference to it as a local storage list.  The const scoping of it will
prevent this type of error in future.)

Fixes https://gitlab.com/kicad/code/kicad/issues/14269
2023-04-04 11:35:06 +01:00
Jeff Young 89e78c0276 Fix Mac crash-on-quit when timed infobar is up.
(cherry picked from commit b3e2cf218f)
2023-04-03 23:47:14 +01:00
Jeff Young 9a57c11348 Possible protection from acessing deleted window data.
(Long shot for Sentry KICAD-MM.)

(cherry picked from commit bd60f38569)
2023-04-03 23:47:09 +01:00
Jeff Young 1dbe8b2a79 Nullptr safety.
(This is a long shot for Sentry KICAD-MV, but you never know....)

(cherry picked from commit a4e8fa96d4)
2023-04-03 23:47:00 +01:00
Seth Hillbrand 29fd0caf58 Update translator contributions
Adds a number of missing contributors to our translations

(cherry picked from commit d135295ac8)
2023-04-03 13:07:33 -07:00
jean-pierre charras d30701ed59 Fix compil warnings.
(cherry picked from commit ac71227e75)
2023-04-03 10:14:14 -07:00
Seth Hillbrand e39550e77f Update to Clipper 1.2+
Updates to Clipper2 742614f, which includes bug fixes for specific KiCad
boards beyond Clipper2 itself

Fixes https://gitlab.com/kicad/code/kicad/issues/14294

(cherry picked from commit 97558b62ec)

Fixes https://gitlab.com/kicad/code/kicad/issues/14475
2023-04-03 10:06:34 -07:00
Jeff Young a21e7a5eee Don't pass a FRAME-based UNITS_PROVIDER to a modeless dialog.
(The dialog may outlive said frame.)
Should fix Sentry KICAD-3A.

(cherry picked from commit 9b4627e782)
2023-04-03 17:20:06 +01:00
Jeff Young 927b5ae707 Use enums for column ids.
(The nickname, in particular, is no longer column 1.)

Fixes https://gitlab.com/kicad/code/kicad/issues/14291
2023-04-02 15:28:11 +01:00
jean-pierre charras f59626004c PCB_TEXT::TransformTextToPolySet(): fix missing code for knockout texts.
From master branch
Fixes #14473
https://gitlab.com/kicad/code/kicad/issues/14473
2023-04-02 10:29:18 +02:00
Jeff Young 2ece2719d0 Naming conventions and nullptr usage. No functional changes. 2023-04-01 15:14:35 +01:00
Jeff Young 78ee542d8d Naming conventions. 2023-04-01 14:11:56 +01:00
Jeff Young cea9b38815 Update local coords after changing footprint item properties.
Fixes https://gitlab.com/kicad/code/kicad/issues/14348

(cherry picked from commit 0f9a4ef7b7)
2023-04-01 13:57:47 +01:00
Jeff Young cb8f6db68d Add hole clearance to moutning hole keepouts for SPECCTRA.
Fixes https://gitlab.com/kicad/code/kicad/issues/14439
2023-04-01 13:57:47 +01:00
Seth Hillbrand 85038c2b46 Prevent PCB Editor from opening multiple board_setup
ShowBoardSetup can be called multiple times from multiple locations,
resulting in duplicate board setup dialog boxes.  This is confusing and
should be prevented.  We use the established patter from the symbol
picker to ensure that only one copy of the dialog is ever opened at a
time

(cherry picked from commit 7695d510d6)
2023-03-30 15:34:42 -07:00
Roberto Fernandez Bautista 1e8055f504 CADSTAR PCB Importer: Ignore construction layers on outer surfaces
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14443

7.0 version of d5bc223ff2 (no strings)
2023-03-31 00:17:06 +02:00
jean-pierre charras a7a5f20d1c Pcbnew: fix incorrect position of cached text shapes when moving a footprint.
when moving a footprint, the position of texts living in FP_TEXT_BOX was
not updated when the text shape was cached (non Kicad fonts).
From master branch.
Fixes #14452
https://gitlab.com/kicad/code/kicad/issues/14452
2023-03-30 17:33:44 +02:00
jean-pierre charras 0d744a4e74 kicad-cli, layer names: allows using both names used in GUI and in board files
From master branch
Fixes #14455
https://gitlab.com/kicad/code/kicad/issues/14455
2023-03-30 13:50:09 +02:00
jean-pierre charras 216ec60dc1 kicad-cli, export drill files: fix duplicate options and fix some others:
- remove --separate-files duplicate option
- change --units to --excellon-units (valid only for Excellon) and default to mm
- Gerber resolution: 5 -> 6 (default must be always the higher resolution)
From Master
Fixes #14454
https://gitlab.com/kicad/code/kicad/issues/14454
2023-03-30 10:35:46 +02:00
Roberto Fernandez Bautista 3d9047bec4 Revert "CADSTAR PCB importer: Fix incorrect position of overridden pads"
This reverts commit 5cab66fb18
2023-03-29 21:53:14 +00:00
Roberto Fernandez Bautista 08d65beb26 CADSTAR PCB importer: Fix loading of rounded rectangle pads
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14445


(cherry picked from commit aaeb8ca739)
2023-03-29 20:56:14 +00:00
Roberto Fernandez Bautista 5cab66fb18 CADSTAR PCB importer: Fix incorrect position of overridden pads
(cherry picked from commit 89441d807d)
2023-03-29 20:55:50 +00:00
jean-pierre charras 9466624f9d Footprint editor: always export the currently loaded footprint.
Previously, it was not always the edited footprint, but a footprint
selected from the library tree.
It was especially annoying when the footprint was loaded from the board editor:
The footprint was not the loaded footprint, but its copy from library.
From master branch
2023-03-29 20:30:25 +02:00
jean-pierre charras 80b842a704 Footprint viewer: ensure the footprint is updated after new library selection
Previously, if the first fp of the new lib has the same name as the old
displayed fp, the old fp was not replace by the new fp.
From master branch
2023-03-29 16:59:12 +02:00
Seth Hillbrand d513a9fe5c Locked shadow needs to be in shadow color
Otherwise, text shadow is stroked by text color

(cherry picked from commit f93fde15b7)
2023-03-28 13:02:18 -07:00
jean-pierre charras c98081cb04 QA test: disable Silk clearance test in solder mask bridge QA test.
the Silk clearance test has nothing to do with a solder mask bridge QA test
From master branch
2023-03-27 12:50:14 +02:00
Jon Evans 17a1dc18be Properties: Hide Net Class from GUI
It is confusing users who want to change the netclass of a net.

(cherry picked from commit 3f42e6b702)
2023-03-26 19:50:10 -04:00
Jon Evans b22ff229db DbLib: Get rid of some GCC warnings
(cherry picked from commit c35cefe1d5)
2023-03-26 19:48:58 -04:00
Jon Evans 23b03fd6ab Properties: Rename methods to better reflect their purposes
(cherry picked from commit 65193487a6)
2023-03-26 19:48:46 -04:00
Jeff Young 97b273905a Manual cherry-pick of a214ac0310. 2023-03-26 21:06:24 +01:00
Jeff Young e759c4d27a Only report on clearances where there was one defined.
If it's 0, it's just a straight-up collision.

(cherry picked from commit 9976b9ce8c)
2023-03-26 20:59:41 +01:00
Jeff Young 76685ae2d9 Run SILK_CLEARANCE rules on mask layer when testing silk-to-mask clearance.
This allows custom rules to be authored without firing the auto-generated
rule from Board Setup > Silk Item Clearance (which should be only for silk-
to-silk clearances).

Fixes https://gitlab.com/kicad/code/kicad/issues/14417

(cherry picked from commit 0266d03f79)
2023-03-26 20:59:36 +01:00
Jeff Young 3fad3ceb35 Update allow-solder-mask-bridges when updating footprint from library.
Fixes https://gitlab.com/kicad/code/kicad/issues/14422
2023-03-26 16:25:54 +01:00
Jeff Young dede9e8549 Test silk/mask collisions on the correct layer.
Fixes https://gitlab.com/kicad/code/kicad/issues/14417
2023-03-26 16:25:54 +01:00
Roberto Fernandez Bautista 97c018118d CADSTAR Sch: TERMATTR may have more than one attribute subnode
Fixes https://gitlab.com/kicad/code/kicad/-/issues/13526


(cherry picked from commit fc04f5135f)
2023-03-26 14:55:06 +00:00
jean-pierre charras 8b1ce36402 QA pcbnew: Add missing golden files and disable issue14294 that always fails.
It needs a Clipper2 update, not yet made in stable branch (made only in testing).
2023-03-26 15:09:35 +02:00
Jeff Young 7931f315b1 Manually cherry-pick some fixes back from master.
Fixes https://gitlab.com/kicad/code/kicad/issues/14424
2023-03-26 11:00:23 +01:00
Marek Roszko abb6404ab2 Move up a layer validity check to prevent crash
Fixes sentry crash KICAD-RF


(cherry picked from commit 604a7d69db)
2023-03-25 21:13:38 +00:00
Wayne Stambaugh c434542c65 Fix GCC compile error.
(cherry picked from commit a79108f102)
2023-03-25 17:35:39 +00:00
Marek Roszko 42b7aa6450 Use read/write locks in the settings_manager to avoid thread issues in some scenarios
Fixes sentry issue KICAD-90


(cherry picked from commit ab28650d57)
2023-03-25 17:35:31 +00:00
jean-pierre charras f2ce9cf857 Plot symbol graphic texts: fix incorrect position of texts in some rotations.
The plot code is now similar to the one for symbol fields
From master branch.
Fixes #14327
https://gitlab.com/kicad/code/kicad/issues/14327
2023-03-25 18:27:35 +01:00
jean-pierre charras 56134d0202 KICAD_CURL_EASY: fix compil warnings (avoid using deprecated functions) 2023-03-25 18:27:35 +01:00
Jeff Young f33bbe2d5d Add regression test for 14412.
(cherry picked from commit 30b3645e60)
2023-03-25 16:16:10 +00:00
Jeff Young 59a478bdc5 Allow solder mask bridges between net-tie-group pads.
Fixes https://gitlab.com/kicad/code/kicad/issues/14412

(cherry picked from commit c5e66361db)
2023-03-25 16:15:46 +00:00
Jeff Young 141b332d4f Add regression test for 13988.
(cherry picked from commit 35ca3e7264)
2023-03-25 15:37:57 +00:00
Jeff Young d4a312d6cb Move separation of model name from params earlier in the process.
We need just the model name when we look for a match in the library file.

(cherry picked from commit 60aadfee40)
2023-03-25 15:37:57 +00:00
Jeff Young 31d688b34c Add regression test for 14334.
(cherry picked from commit e65a58b823)
2023-03-25 15:37:57 +00:00
Jeff Young fbef9ea600 Keep track of single-pad-islands so we can discount spokes to them.
(cherry picked from commit d6dd58fff9)
2023-03-25 15:37:57 +00:00
Marek Roszko 0688491e1b Fix typo
(cherry picked from commit eb90448247)
2023-03-24 23:55:24 +00:00
Marek Roszko 434161687e Fix cli crash due to dialogs buried in the pcb parser...
Fixes sentry KICAD-Q2


(cherry picked from commit 8a8589b9db)
2023-03-24 23:53:15 +00:00
Seth Hillbrand 4b3709b96b Revert "Update to Clipper2 1.2+"
This reverts commit 560717de76.
2023-03-24 12:30:11 -07:00
Seth Hillbrand 1fa993303d Revert "Undefine None for X11 after Clipper2 update"
This reverts commit 4f265a52a2.
2023-03-24 12:30:11 -07:00
Seth Hillbrand 01897e7755 Revert "Fix GCC 13 build error."
This reverts commit 00d1e01e12.
2023-03-24 12:30:10 -07:00
Seth Hillbrand 7040b2178d Revert "Update for Clipper 1.2"
This reverts commit e758391a23.
2023-03-24 12:30:09 -07:00
Seth Hillbrand edf23c4c18 Revert "Clean up various simplify steps"
This reverts commit 798e13f70d.
2023-03-24 12:30:06 -07:00
Jon Evans b0b9e66fad Move to requiring explicit action to save project settings
(cherry picked from commit 610e787ada)

Fixes https://gitlab.com/kicad/code/kicad/issues/14414
2023-03-24 11:49:50 -07:00
Seth Hillbrand 89488a43b9 Pins are case-sensitive
Cleanup should remove mis-matched cases

Fixes https://gitlab.com/kicad/code/kicad/issues/14415

(cherry picked from commit 0984599624)
2023-03-24 11:35:20 -07:00
Seth Hillbrand 798e13f70d Clean up various simplify steps
Adds the option to simplify the output of Clipper ops that remove minor
detours from the output lines.  These detours are not substantive, so
removing them speeds up the rest of the system by removing unimportant
vertices.  This also prevents the introduction of inadvertant concave
points when unioning two, closely-sized rounded shapes
2023-03-24 09:42:01 -07:00
Seth Hillbrand e758391a23 Update for Clipper 1.2 2023-03-24 09:42:01 -07:00
Steven A. Falco 00d1e01e12 Fix GCC 13 build error.
See https://kicad.zulipchat.com/#narrow/stream/258851-Developer-Chat/topic/GCC.20Breakage
for more info.
2023-03-24 09:42:01 -07:00
Seth Hillbrand 4f265a52a2 Undefine None for X11 after Clipper2 update 2023-03-24 09:42:01 -07:00
Seth Hillbrand 560717de76 Update to Clipper2 1.2+
Updates to 303232e, which includes bug fixes for specific KiCad boards
beyond Clipper2 1.2 itself

Fixes https://gitlab.com/kicad/code/kicad/issues/14294
2023-03-24 09:42:01 -07:00
jean-pierre charras 0f40894317 Pcbnew, APPEARANCE_CONTROLS: do not change objects visibility, when changing
layers visibility using Preset layers widget.
Fixes #14381
https://gitlab.com/kicad/code/kicad/issues/14381
2023-03-24 15:06:06 +01:00
jean-pierre charras 3915e882a8 Gerbview: Aperture Macro: handle overwriting of variables
Gerbview did not handle redefinition of variable like $3 = $3 / 2
This redefinition is sometimes found in Gerber files.
This is a long standing issue now fixed.
From master branch
2023-03-24 12:02:49 +01:00
jean-pierre charras c5caa23a63 Manager teardrops on arcs. From master branch. 2023-03-24 11:46:11 +01:00
jean-pierre charras 36978d2ddc Gerber plotter: fix incorrect arcs in regions when using a plot offset.
The arc center in Gerber units was incorrectly calculated.
From master
Fixes #14402
https://gitlab.com/kicad/code/kicad/issues/14402
2023-03-24 11:37:26 +01:00
Marek Roszko 3f90c895b9 Prevent crash in color settings due to dropdown weirdness
Fixes sentry reported crash KICAD-R6


(cherry picked from commit c65e33ac13)
2023-03-23 23:47:13 +00:00
Jon Evans 2ada171806 Be more flexible about extracting booleans from database
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14376


(cherry picked from commit dd8b52af93)
2023-03-23 01:25:09 +00:00
Marek Roszko 5dc683c968 Fix crash editing footprint editor defaults
Missing one level of GetParent()....use a dynamic_cast to sanity check it in debug

Fixes sentry crash KICAD-R4


(cherry picked from commit d49562a7aa)
2023-03-22 22:41:57 +00:00
Jeff Young 7026cfe140 Split name from additional params only when model is a library reference.
(cherry picked from commit b8cf7cc080)
2023-03-22 14:12:42 +00:00
Jeff Young b7cd1dd764 Handle single-token flag parameters.
Also fixes a bug where all VDMOS instance parameters weren't marked as
instance parameters.

Also fixes a bug where VDMOS thermal models weren't supported (they
have two extra pins: Tj and Tcase).

(cherry picked from commit 5bda3b99f9)
2023-03-22 14:12:42 +00:00
Jeff Young 09bb8fc4f4 Don't include non-overridden parameters in Sim.Params.
Fixes https://gitlab.com/kicad/code/kicad/issues/14369

(cherry picked from commit 9dc16eb014)
2023-03-22 14:12:42 +00:00
jean-pierre charras 746ab49d36 Ensure 3D shapes are always shown in footprint settings dialog.
From master branch
Fixes #14371
https://gitlab.com/kicad/code/kicad/issues/14371
2023-03-22 08:53:42 +01:00
Jeff Young 1614dc975a Separate legacy model name from parameters.
Fixes https://gitlab.com/kicad/code/kicad/issues/13988

(cherry picked from commit 39a801423e)
2023-03-21 13:31:20 +00:00
Alex ba7598d90d Fix clashing error dialogs when can't load dynamic library.
(cherry picked from commit 672c468342)
2023-03-21 09:57:46 +00:00
Alex 92fc4872e8 GTK: Fix settings import paths showing up twice.
(cherry picked from commit b89545e484)
2023-03-21 09:57:28 +00:00
jean-pierre charras 30dbfc33a4 step exporter: fix missing initialization of a member (m_pcbBaseName)
EXPORTER_STEP: rename m_pcbName to m_pcbBaseName.
From master.
2023-03-21 09:52:41 +01:00
Mark Roszko b3de5aa08e Put the project name back into the step pcb label.
Software like Solidworks and other CAD treat STEP labels as unique entries.
When you import multi STEP files into the same project, it'll start deduplicating your design by those name.
So two completely unrelated PCBs with the same "PCB" name will result in one being replaced by another.
2023-03-21 01:18:33 +00:00
Jeff Young ba4773e448 Orthogonal dimension are always cardinal, even when their start points are not.
Fixes https://gitlab.com/kicad/code/kicad/issues/13728

(cherry picked from commit bb2a0f825a)
2023-03-20 21:32:06 +00:00
Jeff Young a713ee852c Ignore extraneous LTSpice parameters for VDMOS models.
Also adds special case handling of VDMOS syntax to allow parens (or extra
spaces, linebreaks, etc.) between "VDMOS" and "NCHAN"/"PCHAN".

Fixes https://gitlab.com/kicad/code/kicad/issues/14299
2023-03-20 16:16:13 +00:00
jean-pierre charras a65accd412 EDA_SHAPE_DESC(): catch a std::runtime_error when emitted by
template<typename T> T Get( PROPERTY_BASE* aProperty ) to avoid a crash,
and displays in Debug mode the runtime error message.
From master branch.
Fixes #14347
https://gitlab.com/kicad/code/kicad/issues/14347
2023-03-20 16:21:54 +01:00
Jeff Young 1dc9583e06 Don't attempt to load unknown plot types. 2023-03-20 10:24:22 +00:00
Jeff Young 3afe02ac1f Make sure legend reflects gain/phase for AC small signal analyses.
Fixes https://gitlab.com/kicad/code/kicad/issues/14301

(cherry picked from commit ec6d709929)
2023-03-20 10:24:22 +00:00
Jeff Young 57aa61f1ba Formatting. (No functional changes.)
(cherry picked from commit 6f44b85c13)
2023-03-20 09:59:30 +00:00
Jeff Young 121ea14fe4 Filter Selected Items... is inclusive, not exclusive.
Fixes https://gitlab.com/kicad/code/kicad/issues/14273

(cherry picked from commit 897984aa22)
2023-03-19 21:31:08 +00:00
Jeff Young 9d457dc0ab Less nagging. (If we need a field name, then create one.)
Also cleans up empty fields when exiting the dialog.
2023-03-19 19:15:28 +00:00
Jeff Young befd836ab4 Clean up items which weren't pasted from clipboard.
Fixes https://gitlab.com/kicad/code/kicad/issues/14335

(cherry picked from commit ad5d3d4eba)
2023-03-18 23:38:09 +00:00
Jeff Young 044c301d64 Remove accelerator keys from schematic find/replace dialog.
Fixes https://gitlab.com/kicad/code/kicad/issues/14304

(cherry picked from commit afe813cae5)
2023-03-18 23:38:09 +00:00
jean-pierre charras 94fd0df2e2 BOARD_NETLIST_UPDATER: add missing count of warnings
From master branch
Fixes #14290
https://gitlab.com/kicad/code/kicad/issues/14290
2023-03-18 17:57:07 +01:00
Salvador E. Tropea e5087ca3db Load the global fp-lib-table before running the Python DRC
Without this we get parity errors for all the KiCad footprints
2023-03-17 21:00:41 +00:00
jean-pierre charras 819a9da599 Pcbnew: fix crash when loading a library with a ft containing a dimension.
(crash due to the use of a null pointer during loading)

(cherry picked from commit 5735a57504)
2023-03-17 16:00:34 +00:00
Jeff Young fb02e55424 Don't pass a REPORTER when checking for overrides.
It fails the unit tests (as it generates a message whenever no override
is found).
2023-03-17 15:30:24 +00:00
Jeff Young 70e86434ef Manual cherry-pick of much of 6d296038f3 2023-03-17 14:12:58 +00:00
Jeff Young c41b1e2f06 Manual cherry-pick of bug fix part of ee1d9c561c. 2023-03-17 13:35:23 +00:00
Jeff Young 64641c28ef Handle underscore in parameter names.
Fixes https://gitlab.com/kicad/code/kicad/issues/14308

(cherry picked from commit 222cd4d009)
2023-03-16 23:51:56 +00:00
jean-pierre charras 69e9f4ada2 DIALOG_LABEL_PROPERTIES, add global label: better filtering of candidates.
The list of candidates (names) must be restricted to existing global labels
and symbols creating a global net name: power symbols having only one power
input pin (a power output does not create net name).
Fixes #14319
https://gitlab.com/kicad/code/kicad/issues/14319
2023-03-16 16:01:18 +01:00
Wayne Stambaugh d28cf632e4 Coverity fixes and code cleaning.
(cherry picked from commit a1fb8e1b1d)
2023-03-16 10:59:05 -04:00
Alex b466bfa6c8 Improve anti-overflow in SEG::intersects.
Caused issues when testing against
A=( -INT_MAX, ... ), B=( INT_MAX, ... ) segments.

Fixes https://gitlab.com/kicad/code/kicad/issues/14293


(cherry picked from commit 98e635869f)
2023-03-16 02:50:22 +00:00
Alex 1c06f4cf06 Don't create 0-length tracks when placing via in the middle of a track.
(cherry picked from commit 8fe78101db)
2023-03-16 02:49:54 +00:00
jean-pierre charras 25f40566ed Symbol editor: fix incorrect position of fields when loading a symbol from schematic.
In symbol editor, symbols are always shown not mirrored, not rotated.
So if the loaded symbol from schematic was rotated/mirrored, the position
of fields must be recalculated for the rotation 0, no mirror.
From master branch
2023-03-15 18:03:11 +01:00
Marco Ciampa e8fa2cbc4d Small fix in Italian translation 2023-03-15 13:35:38 +01:00
Marco Ciampa 779c441e0a Small fix in Italian translation 2023-03-15 13:31:29 +01:00
Marco Ciampa e33031ee7d Updated Italian translation 2023-03-15 10:18:07 +01:00
jean-pierre charras ae63313b55 PDF plotter: encode the letters ( and ) in strings with context CTX_JS_STR
They are separators and cannot be used in user strings.
Fixes #14302
https://gitlab.com/kicad/code/kicad/issues/14302
2023-03-15 09:36:01 +01:00
jean-pierre charras ae50b8d839 make QA link-able on msys2 (from master branch). 2023-03-14 18:05:18 +01:00
Jeff Young 10a27156c2 Defenses in depth for ratsnest drawing.
(cherry picked from commit e60837ec95)
2023-03-14 12:00:03 +00:00
Jeff Young 94057886a3 Support SHEET_PATH when printing.
Fixes https://gitlab.com/kicad/code/kicad/issues/14233

(cherry picked from commit dc78797274)
2023-03-14 11:56:33 +00:00
Jeff Young 2d9bcb6e4f Select correct face from a .ttc file.
Fixes https://gitlab.com/kicad/code/kicad/issues/13314

(cherry picked from commit 7b3e01ce52)
2023-03-14 11:56:33 +00:00
Jeff Young 249bcd9e1a Update dimension units when opening PCBs in CLI.
Fixes https://gitlab.com/kicad/code/kicad/issues/14170

(cherry picked from commit a0adb59437)
2023-03-14 11:56:33 +00:00
Jeff Young b2679b7648 Swap pins for undo.
Fixes https://gitlab.com/kicad/code/kicad/issues/14100

(cherry picked from commit c266913ec7)
2023-03-14 11:56:33 +00:00
Seth Hillbrand 9995b8714b Check for dirtied items in the cluster
When drawing the ratsnest, we need to be careful to avoid accessing
CONN_ITEMs that have been changed by the underlying model.  Checking for
dirty items instead of valid items will prevent us looking at data that
are out of date

Fixes https://gitlab.com/kicad/code/kicad/issues/14265

(cherry picked from commit 283770fc45)
2023-03-13 16:11:27 -07:00
jean-pierre charras 7b4dd2f7f5 DIALOG_BOARD_REANNOTATE: ensure indexes are not out of bound. 2023-03-13 20:25:54 +01:00
Seth Hillbrand cc6b01cf88 Force initialization of board units
Unitialized variables are the devil's playground

(cherry picked from commit f0892598a4)
2023-03-13 12:15:51 -07:00
Seth Hillbrand 3568ff72bf Avoid drawing null-arcs in 3d viewer
An arc with no radius or no angle is not visible and should be avoided

Fixes https://gitlab.com/kicad/code/kicad/issues/14271

(cherry picked from commit 72ebe5a429)
2023-03-13 11:48:24 -07:00
Jeff Young e20614660b Fix qa gold value.
(cherry picked from commit 6eb73133f0)
2023-03-12 21:06:28 +00:00
Jeff Young c5a69f073c Added PSPICE/LTSPICE JFET model parameters.
Fixes https://gitlab.com/kicad/code/kicad/issues/12425

(cherry picked from commit 3bc5e3dd8a)
2023-03-12 21:05:06 +00:00
Jeff Young 3025671b1a Add missing command to SPICE directives list.
Fixes https://gitlab.com/kicad/code/kicad/issues/14215

(cherry picked from commit 6d29088668)
2023-03-12 21:04:50 +00:00
Jeff Young 74da0043b4 Move automatic dimension processing inside PCB_DIMENSION_BASE.
Also move dimension precision to an enum so it can get a proper dropdown
in the properties inspector.

(cherry picked from commit 461def2719)
2023-03-12 21:04:09 +00:00
Jeff Young c0ddca12df Add Property Inspector support for dimension objects.
Includes changing the class hierarchy so that dimension objects inherit
from PCB_TEXT rather than containing a PCB_TEXT member variable.

(cherry picked from commit 23accffc6d)
2023-03-12 21:03:58 +00:00
Jeff Young bf55e610b9 Handle plotting of text on solder mask layer.
Admittedly this is an odd thing to do, but we should still be internally
consistent, and it has come up in customers' files.

Fixes https://gitlab.com/kicad/code/kicad/issues/14226
2023-03-12 21:00:19 +00:00
Mark Roszko 4e775a4090 Move vcpkg forwards for newer curl and python 3.9.16 2023-03-12 02:18:35 +00:00
Jon Evans 9f7b31b5c5 Do not try to process invalid ratsnest nodes
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14254


(cherry picked from commit 8eaa3cfac9)
2023-03-11 21:12:33 +00:00
Simon Richter 279641df73 Avoid "suggest parentheses around assignment used as truth value" 2023-03-10 23:09:41 +01:00
Wayne Stambaugh 9e1fd16329 Coverity fixes and code cleaning.
(cherry picked from commit 4e99812145)
2023-03-10 11:21:19 -05:00
Wayne Stambaugh d6ff5f0239 Begin 7.0.2 development. 2023-03-09 17:03:32 -05:00
Wayne Stambaugh 3f5d3fa0c6 Tag release version 7.0.1. 2023-03-09 16:59:45 -05:00
Seth Hillbrand 51dc2b109e Handle fully-nested zones
The logic to handle divots needs to account for fully nested, same net
zones.  The process of subtracting led to us considering the inner zone
to be a zone knock-out (negative polygon).  To avoid this, we need to
check if the inner, higher priority zone has any connection to the outer
zone.  If it does not, then we can treat it as an isolated zone without
worrying about divots to the outer zone.

(cherry picked from commit 9146e38af4)
2023-03-09 09:25:20 -08:00
mitxela 2358ff6f07 Helper function to allow net.GetNetClassName()
(cherry picked from commit 734d3667a8)
2023-03-09 14:03:02 +00:00
mitxela 11788d2f39 Expose shared_ptr to swig
Possibly not the right way to go about it but technically works


(cherry picked from commit 182abd4652)
2023-03-09 14:02:48 +00:00
mitxela 541f7467c6 Fix python GetAllNetClasses
(cherry picked from commit 716328e511)
2023-03-09 14:02:34 +00:00
jean-pierre charras 411c9707ee specctra export: fix handling of multi-layer zones.
(from master branch)
2023-03-07 15:45:28 +01:00
Jon Evans ee0ba17c03 Improve HiDPI handling of appearance/layer controls
(cherry picked from commit 43d3a18b86)
2023-03-07 08:49:06 -05:00
Jon Evans 64bc850d8f Fix layer widget in HiDPI situations
(cherry picked from commit 89ef6b36f4)
2023-03-07 08:49:06 -05:00
Jeff Young 154f64dae3 Edge connectors shouldn't trigger edge clearance violations.
Fixes https://gitlab.com/kicad/code/kicad/issues/14199

(cherry picked from commit 33e7c78533)
2023-03-07 12:23:56 +00:00
Johannes Maibaum 7fa758358f Don't bracket KICAD_VERSION when using git describe
(Cherry-picked from 75424cb246)
2023-03-07 10:40:28 +00:00
Salvador E. Tropea f135881bd6 Use constants for the names of the built-in colors
- Avoid repetition and errors from typos
- Allow simple changes
- Simpler data type handling, the constants are wxString
2023-03-07 10:32:18 +00:00
Seth Hillbrand 839301f81e Revert "Consolidated ERC fixes"
This reverts commit 2127712115.

Version uses functions only available in the master branch.  Will revert
for 7.0.2 to allow targeted update
2023-03-06 21:22:55 -08:00
Seth Hillbrand 04f4ca9772 Update translations 2023-03-06 16:55:17 -08:00
Rigo Ligo 525328fba1 Translated using Weblate (Chinese (Simplified))
Currently translated at 100.0% (8011 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/zh_Hans/
2023-03-07 01:50:07 +01:00
boonchai k 471c125c1a Translated using Weblate (Thai)
Currently translated at 89.2% (7148 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/th/
2023-03-07 01:50:07 +01:00
Tokita, Hiroshi 8ef99137c6 Translated using Weblate (Japanese)
Currently translated at 100.0% (8011 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/ja/
2023-03-07 01:50:07 +01:00
boonchai k 404cad062a Translated using Weblate (Thai)
Currently translated at 88.6% (7104 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/th/
2023-03-07 01:50:07 +01:00
dsa-t d4be813f2e Translated using Weblate (Russian)
Currently translated at 100.0% (8011 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/ru/
2023-03-07 01:50:06 +01:00
Jonathan Haas ab3c0b2f03 Translated using Weblate (German)
Currently translated at 99.9% (8009 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/de/
2023-03-07 01:50:06 +01:00
CloverGit defcfc2962 Translated using Weblate (Chinese (Simplified))
Currently translated at 100.0% (8011 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/zh_Hans/
2023-03-07 01:50:06 +01:00
Jan Straka 267cfdf54b Translated using Weblate (Czech)
Currently translated at 90.1% (7218 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/cs/
2023-03-07 01:50:06 +01:00
turkce a7b0231b3c Translated using Weblate (Turkish)
Currently translated at 42.1% (3375 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/tr/
2023-03-07 01:50:06 +01:00
turkce 7c19958840 Translated using Weblate (Turkish)
Currently translated at 41.3% (3310 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/tr/
2023-03-07 01:50:06 +01:00
ssantos 34c3bb7d2c Translated using Weblate (Portuguese)
Currently translated at 99.8% (8001 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/pt/
2023-03-07 01:50:06 +01:00
Toni Laiho b37545ee6c Translated using Weblate (Finnish)
Currently translated at 100.0% (8011 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/fi/
2023-03-07 01:50:05 +01:00
Henrik Kauhanen c1e924c894 Translated using Weblate (Swedish)
Currently translated at 99.9% (8007 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/sv/
2023-03-07 01:50:05 +01:00
Tom Niesse 200e9e28ea Translated using Weblate (Dutch)
Currently translated at 82.8% (6638 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/nl/
2023-03-07 01:50:05 +01:00
Henrik Kauhanen b95f958890 Translated using Weblate (Swedish)
Currently translated at 99.9% (8007 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/sv/
2023-03-07 01:50:05 +01:00
김랑기 fe9666bdaf Translated using Weblate (Korean)
Currently translated at 100.0% (8011 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/ko/
2023-03-07 01:50:05 +01:00
Henrik Kauhanen 948de5dc79 Translated using Weblate (Finnish)
Currently translated at 100.0% (8011 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/fi/
2023-03-07 01:50:05 +01:00
Toni Laiho 8800fd8250 Translated using Weblate (Finnish)
Currently translated at 100.0% (8011 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/fi/
2023-03-07 01:50:05 +01:00
Henrik Kauhanen b1e5d8c915 Translated using Weblate (German)
Currently translated at 99.9% (8009 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/de/
2023-03-07 01:50:05 +01:00
Henrik Kauhanen 02aec8b091 Translated using Weblate (Swedish)
Currently translated at 99.9% (8005 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/sv/
2023-03-07 01:50:04 +01:00
김랑기 50517f6aa6 Translated using Weblate (Korean)
Currently translated at 100.0% (8011 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/ko/
2023-03-07 01:50:04 +01:00
Henrik Kauhanen a752473280 Translated using Weblate (Finnish)
Currently translated at 99.9% (8010 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/fi/
2023-03-07 01:50:04 +01:00
Henrik Kauhanen 7e1972d483 Translated using Weblate (German)
Currently translated at 99.9% (8009 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/de/
2023-03-07 01:50:04 +01:00
Henrik Kauhanen de48bf04bc Translated using Weblate (Swedish)
Currently translated at 99.9% (8006 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/sv/
2023-03-07 01:50:04 +01:00
Henrik Kauhanen 228bf66cac Translated using Weblate (Finnish)
Currently translated at 99.9% (8010 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/fi/
2023-03-07 01:50:04 +01:00
Jan Straka c986c1d26a Translated using Weblate (Czech)
Currently translated at 89.7% (7188 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/cs/
2023-03-07 01:50:04 +01:00
Henrik Kauhanen b0f7ea5b16 Translated using Weblate (Swedish)
Currently translated at 99.9% (8006 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/sv/
2023-03-07 01:50:04 +01:00
Jan Sobków 8b2e2ff1f8 Translated using Weblate (Polish)
Currently translated at 100.0% (8011 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/pl/
2023-03-07 01:50:03 +01:00
Toni Laiho d00166223f Translated using Weblate (Finnish)
Currently translated at 100.0% (8011 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/fi/
2023-03-07 01:50:03 +01:00
Toni Laiho 4701b4bfc2 Translated using Weblate (Finnish)
Currently translated at 100.0% (8011 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/fi/
2023-03-07 01:50:03 +01:00
Ivan Chuba e4c74c727f Translated using Weblate (Ukrainian)
Currently translated at 100.0% (8011 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/uk/
2023-03-07 01:50:03 +01:00
Henrik Kauhanen f626ce29c4 Translated using Weblate (Swedish)
Currently translated at 99.9% (8006 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/sv/
2023-03-07 01:50:03 +01:00
Wellington Terumi Uemura 768d8e5811 Translated using Weblate (Portuguese (Brazil))
Currently translated at 100.0% (8011 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/pt_BR/
2023-03-07 01:50:03 +01:00
ZbeeGin 2ac3a4a103 Translated using Weblate (Polish)
Currently translated at 100.0% (8011 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/pl/
2023-03-07 01:50:03 +01:00
Toni Laiho bb512f3fc0 Translated using Weblate (Finnish)
Currently translated at 100.0% (8011 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/fi/
2023-03-07 01:50:03 +01:00
Henrik Kauhanen d6e7a89c97 Translated using Weblate (Finnish)
Currently translated at 100.0% (8011 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/fi/
2023-03-07 01:50:03 +01:00
Ulices a5455da909 Translated using Weblate (Spanish (Mexico))
Currently translated at 100.0% (8011 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/es_MX/
2023-03-07 01:50:02 +01:00
Henrik Kauhanen 8dadc698cc Translated using Weblate (German)
Currently translated at 99.9% (8010 of 8011 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/de/
2023-03-07 01:50:02 +01:00
James J 2127712115 Consolidated ERC fixes
- Consistent calculation of IsStacked() for pins across ERC checks
 - Correct placement of ERC marker for unresolved field variables
 - Add sheet-specific paths to two ERC check results

(cherry picked from commit 39e56485fc)
2023-03-06 16:38:11 -08:00
Mario Luzeiro d5b635027e 3D-Viewer: sort models and material models when rendering in transparent
Also enables transparency on model preview and small optimizations fixes

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14005

(cherry picked from commit 7bc976f3f4)
2023-03-06 16:24:24 -08:00
Graham Keeth 9b2aeda51e Fix column offset in BOM script
Debugged by @svk28

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14128

(cherry picked from commit cc110399ea)
2023-03-06 16:23:31 -08:00
Seth Hillbrand 5aba9b539f Revert font spacing/tabs to the v6 model
While convoluted, this model matches as best we have found so far, the
alignment with scintilla.  The spacing is character size for N-1 of the
characters in the 4-space tab stops.  The final character is sized for
the actual space character in the stroke font (0.761905)

Fixes https://gitlab.com/kicad/code/kicad/issues/13791

(cherry picked from commit bce402a01c)
2023-03-06 16:23:06 -08:00
JamesJCode b82020722b Eeschema netlist output: Propagate NC across hierarchical schematics
Fixes #12580

Additionally does not export no_connect netlist annotation on pins
which are both connected to another pin and a NC item, unless all
connected pins are stacked at the symbol level.

Adds testing of pin types to netlist QA unit tests.

(cherry picked from commit 9dca70a773)
2023-03-06 16:22:25 -08:00
Seth Hillbrand b62a8fe65a Handle excessively large values when hatching
While unusual, ensure that hatched zones don't break KiCad if they are
close to the integer limit

Fixes https://gitlab.com/kicad/code/kicad/issues/14066

(cherry picked from commit ffcc0e50b7)
2023-03-06 16:21:13 -08:00
Seth Hillbrand a5d85e3281 Bitmaps are not actually copper
We report bitmaps as being 'on' a copper layer because they are
associated with it but they are not actually physical parts so should
not be included in the DRC checks

Additionally, Bitmaps effective shape starts are the top left corner
rather than the center (unclear why that was there in the first place)

Fixes https://gitlab.com/kicad/code/kicad/issues/14065

(cherry picked from commit 1b8b216ac8)
2023-03-06 16:20:44 -08:00
Seth Hillbrand e699bcf5a3 Use Chamfer lines when deflating
Rounded line ends when deflating leads to microscopic jags in the
outline that are not visible but add substantial computation time and
minor error when computing polygon offsets.

Instead, the chamfer deflate method prevents these jagged lines by
clipping angles < 90° by the error level.  This does not impact deflate
calls where we explicitly require the angles to be maintained

(cherry picked from commit af10878954)
2023-03-06 16:18:51 -08:00
Seth Hillbrand 7ef5e079fd Smarten connection width checker looking for splits
Fractured polygons are always fractured along the x-axis, so when
checking to see if a segment is a fracture point, we check if the y
coordinate is equal.  This avoids situations where there are multiple
fracture points between two inflection points

Additionally, we add a second check to ensure we don't hit spurious
blobs (all kinks should be symmetric and therefore be substantial in
each direction)

Fixes https://gitlab.com/kicad/code/kicad/issues/14130

(cherry picked from commit 7653a2bf99)
2023-03-06 16:14:56 -08:00
Jeff Young 4076461347 Make SPICE netlist title explicit.
Fixes https://gitlab.com/kicad/code/kicad/issues/14183

(cherry picked from commit 6838de962b)
2023-03-06 23:09:51 +00:00
qu1ck d610486c1e Add vector3 to swig
Fixes regression in 7.0 making fp 3d model offsets not accessible in
python

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14179

(cherry picked from commit 88062c5fc3)
2023-03-06 11:23:09 -08:00
Christoph Moench-Tegeder 1891e2ad68 CMakeLists.txt: do not use -ffloat-store on clang
According to it's User Manual, clang does not know about -ffloat-store.
This is corrobated by the FreeBSD i386 build (using LLVM 13 and 15,
depending on the base system version) failing early with an error
message complaining about this parameter being unknown.

See
https://pkg-status.freebsd.org/beefy17/data/main-i386-default/pb27279cba1ca_sed03776ca7/logs/kicad-7.0.0,2.log
for an example of the failure, and
https://clang.llvm.org/docs/UsersManual.html#controlling-floating-point-behavior
for the available floating point options on clang.

(Cherry-picked from 46a59aa2c3)
2023-03-06 16:01:55 +00:00
aris-kimi f1e060902b Simulator: Fix RLGC c unit
(Cherry-picked from db2780090c)
2023-03-06 15:59:54 +00:00
Jeff Young 7dbd920912 Don't allow footprint editor pad tools to run outside footprint editor.
(They can get called if a user re-assigns hotkeys to them.)

Fixes https://gitlab.com/kicad/code/kicad/issues/14166
2023-03-06 14:43:20 +00:00
aris-kimi 05ab9e3836 Simulator: Fix diode ibv unit
(Cherry-picked from 5b43dc4e7b)
2023-03-06 14:20:33 +00:00
Jeff Young a4e0f1f7aa Support both wxWidgets APIs for excluded characters.
(Sadly they're mutually incompatible.)

Fixes https://gitlab.com/kicad/code/kicad/issues/14153

(cherry picked from commit b5060d2951)
2023-03-06 14:17:11 +00:00
Jeff Young a8f27d13e6 Use name (even for fallback models) *if* it's specified in dropdown.
Fixes https://gitlab.com/kicad/code/kicad/issues/12425

(cherry picked from commit 7547e550aa)
2023-03-06 11:18:14 +00:00
Jeff Young 05d425ea88 Add 12505 to the regression test suite.
Fixes https://gitlab.com/kicad/code/kicad/issues/12505

(cherry picked from commit d96598c87c)
2023-03-06 10:27:46 +00:00
Jeff Young 3cb12b5a60 Allow others to also process units changed event.
Fixes https://gitlab.com/kicad/code/kicad/issues/14156

(cherry picked from commit 6a5f305684)
2023-03-05 16:07:00 +00:00
Alex 8f1237e629 bom_csv_grouped_extra: use field-specific methods for data.
Fixes https://gitlab.com/kicad/code/kicad/issues/14129


(cherry picked from commit c1f4911d7e)
2023-03-05 00:26:46 +00:00
Wayne Stambaugh 2c7f44f78d Coverity fixes and code cleaning.
(cherry picked from commit 789bf6455a)
2023-03-04 13:14:59 -05:00
Jeff Young a9447aa8c7 Add UNITS_CHANGED handling to 3D preview controls.
Fixes https://gitlab.com/kicad/code/kicad/issues/14156

(cherry picked from commit 915b352d9b)
2023-03-04 12:12:34 +00:00
Jeff Young 9b61b350fe Don't commit changes on paint events or updateUI events.
Also use std::numeric_limits::epsilon for comparing doubles.

Fixes https://gitlab.com/kicad/code/kicad/issues/13851

(cherry picked from commit d714ff8549)
2023-03-04 00:10:39 +00:00
Alex e3cf65fbdf Fix bitmap scaling when reading legacy schematic as well.
(cherry picked from commit bfc3e2d29b)
2023-03-03 22:39:38 +00:00
Jeff Young e51d43568e Prefer Clamp() to std::min( std::max() ).
(cherry picked from commit d545216432)
2023-03-03 21:32:19 +00:00
Jeff Young 1bb6b7acdd Overflow safety.
Potential fix for some or all of
https://gitlab.com/kicad/code/kicad/-/issues/13969

(cherry picked from commit 2f2a00c307)
2023-03-03 21:32:12 +00:00
Seth Hillbrand adc7a3ba4a Correct parent symbol for lib_text
The edited symbol should be pulled from the parent window when there is
not an existing text object

(cherry picked from commit 59fc62e898)
2023-03-03 12:40:56 -08:00
Jeff Young 94ec6cc362 Convert inline models in Sim.Params fields to SPICE syntax.
Fixes https://gitlab.com/kicad/code/kicad/issues/14157

(cherry picked from commit 14f1f3ec79)
2023-03-03 18:18:32 +00:00
Jeff Young bbdb5eb6e3 Use resolved fields when generating LIB_TREE info.
Fixes https://gitlab.com/kicad/code/kicad/issues/13737

(cherry picked from commit 2fb24347ad)
2023-03-03 17:23:13 +00:00
Jeff Young e487ca8bd8 Handle alternate pin definitions when printing.
Fixes https://gitlab.com/kicad/code/kicad/issues/14122

(cherry picked from commit 2973d292d9)
2023-03-03 12:57:03 +00:00
Jeff Young f5b0e20f78 The screen for undo is the screen that *owns* the SCH_SHEET...
... not the screen the SCH_SHEET owns.

Fixes https://gitlab.com/kicad/code/kicad/issues/14099

(cherry picked from commit 5849458476)
2023-03-03 00:23:41 +00:00
Seth Hillbrand 6116eebbad Prevent inf when presented with 0 errormax
acos(1) returns 0, so this implies infinite segements to get to 0 error.
This is not reasonable but might be encountered in bad arcs or circles
that have 0 radius.  Instead of returning infinite or std::max segments,
we limit the error to be at least 1 IU

(cherry picked from commit 1fda68099f)
2023-03-02 10:21:25 -08:00
Jeff Young 8619705e44 Hook up AddField handler to GRID_TRICKS for SCH dialogs.
Fixes https://gitlab.com/kicad/code/kicad/issues/git/14153
2023-03-02 18:16:02 +00:00
Jeff Young c216ed2d1f Make SME prop-grid hack Mac-only.
Fixes https://gitlab.com/kicad/code/kicad/issues/13852

(cherry picked from commit dcba555d44)
2023-03-02 14:59:57 +00:00
Jeff Young e17dc25bba Add support for non-cardianlly-rotated text boxes.
Also fixes a couple of bugs in text boxes in flipped footprints.

Fixes https://gitlab.com/kicad/code/kicad/issues/14112

(cherry picked from commit 7638e23ff1)
2023-03-02 14:58:44 +00:00
Salvador E. Tropea d311915f9d Fix the CONNECTIVITY_DATA::GetNetItems Python API
- The C++ member now uses std::vector<KICAD_T>
- The Python side can use a single value or a list,
  like in v6.

The std::vector translation is based on the v6 KICAD_T[]
translation.
2023-03-01 18:49:12 +00:00
Jeff Young 3a95826b42 Move only-write-model-if-it-contains-overrides up to base class.
It's necessary to keep us from writing out model lines for included
models and fall-backs of included models.

(cherry picked from commit f5edcf82f2)
2023-03-01 13:44:26 +00:00
jean-pierre charras dcc1009162 plotters rework: add plot fct to use TEXT_ATTRIBUTES class to pass text settings
Old PLOTTER::Text is not (yet) removed, but it use negative text size
to mirrored text, which is not really compatible with some plotters (especially PDF).
Using TEXT_ATTRIBUTES is much easy and much better,
so PLOTTER::PlotText() is added.
Note: "old" PLOTTER::Text() is not removed yet.
From master, commit 51d46c0e73
2023-03-01 10:45:23 +01:00
jean-pierre charras d61e01ff4f Plot Gerber format: ensure all attributes are added to polygon items.
Especially, TA.AperFunction,EtchedComponent for net tie footprints using polygons.
From master, commit ece34e1a0c
2023-03-01 09:39:15 +01:00
Seth Hillbrand 51b9d8e7ad Allow for rounding error in connection width checker
We perform checks using squared distance but this loses the integer
rounding in the standard norm.  To correct for this, we allow a single
IU in the restriction, allowing fractionally smaller connection widths
before calculating the squared limit

Fixes https://gitlab.com/kicad/code/kicad/issues/14130

Fixes https://gitlab.com/kicad/code/kicad/issues/14131

(cherry picked from commit a0f99ea8ba)
2023-02-28 15:26:49 -08:00
qu1ck 90eb5e9c31 PCM: auto reload global libs after dialog is run
This adds Reset() method to KIFACE to reload global libs stored in
global static vars.
Also refactors some lib reload code in various frames to have
common MAIL_RELOAD_LIB handler.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/12500

(cherry picked from commit 2975f53647)
2023-02-28 16:48:28 -05:00
Seth Hillbrand 17c34c88dc Avoid forcing all units
When the enduser is not allowed to change the status of "common to all
units", then it should be disabled

Fixes https://gitlab.com/kicad/code/kicad/issues/14084

(cherry picked from commit 3207d1386e)
2023-02-28 13:42:51 -08:00
aris-kimi ff6f658f9d Simulator: Fix some cases with initial conditions
(cherry picked from commit 4a761179d0)
2023-02-28 21:31:45 +00:00
Seth Hillbrand fb798a4150 Export footprint pad holes to STEP regardless
Footprint pad holes form a part of the board outline regardless of
whether the footprint is in the BOM or not

Fixes https://gitlab.com/kicad/code/kicad/issues/14013

(cherry picked from commit daf70f9b6a)
2023-02-28 12:02:40 -08:00
Salvador E. Tropea 4213bb3a62 Fix rounding errors in gerber files
The userToDeviceCoordinates helper returns a VECTOR2D
Converting it to VECTOR2I back and forth generates rounding errors
Also is a waste of time
2023-02-28 19:23:26 +00:00
Jeff Young 8a34f91172 Fix for overwriting non-specified constraints.
Fixes https://gitlab.com/kicad/code/kicad/issues/14070
2023-02-28 18:29:43 +00:00
jean-pierre charras 764ddd4773 Fix compil warnings. 2023-02-28 18:00:22 +01:00
jean-pierre charras ea0dcc8ebd Fixes in build board outlines as polygon and convert_shape_list_to_polygon:
- Ensure Bezier curves have their polygon build before use it.
- When building board outlines as polygon the same chaining epsilon value
for DRC, export step and 3D view (default 0.01mm).
Fixes #14115
https://gitlab.com/kicad/code/kicad/issues/14115
Fixes #14009
https://gitlab.com/kicad/code/kicad/issues/14009
2023-02-28 17:26:28 +01:00
jean-pierre charras 3f5db9f7f9 EXPORTER_STEP: handle sub-layers in dielectric layer.
A dielectric layer (between 2 copper layers) can be made by more than one
layer (composite dielectric).  Not frequent, but possible.
sub-layers where previously ignored.
2023-02-28 17:25:40 +01:00
Jeff Young a6a0bba1b7 Stage group children when staging group.
Many operations such as move, rotate, etc. are applied directly to the
group's children, so it's the children that need staging.

Fixes https://gitlab.com/kicad/code/kicad/issues/13999
2023-02-28 14:21:12 +00:00
Jeff Young 5ec785e2f7 Spacing & font-size issues in 3D model preview dialog.
Fixes https://gitlab.com/kicad/code/kicad/issues/13880

(cherry picked from commit 7bb006c91d)
2023-02-28 14:21:12 +00:00
Graham Keeth f7d9f1f69d Fix SPICE pins for BJTs and MESFETs
- MESFETs don't have a substrate/bulk pin
- BJTs have a substrate pin, and HICUM/VBIC have TJ

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/13848

(cherry picked from commit 6af3dadaee)
2023-02-28 14:21:12 +00:00
Jeff Young 42efd2d005 Make substrate and thermal junction nodes optional.
Fixes https://gitlab.com/kicad/code/kicad/issues/14083

(cherry picked from commit 1fdc81e68d)
2023-02-28 14:21:12 +00:00
Jeff Young d32e13daee Clear model name when switching to internal model.
Also fixes a bug to ensure that a modelLine gets written when using
an internal model.

Fixes https://gitlab.com/kicad/code/kicad/issues/14083

(cherry picked from commit 2e5bf0210a)
2023-02-28 14:21:12 +00:00
Jeff Young e82c21e944 Get rid of m_sortedSymbolPinList in favour of a properly scoped variable.
Fixes https://gitlab.com/kicad/code/kicad/issues/14083

(cherry picked from commit 2a79a453ec)
2023-02-28 14:21:12 +00:00
Johannes Pfister 33f835a437 When importing legacy PCB dimension: Use automatic dimension when Unit couldn't be determined
(cherry picked from commit a87550a2c6)
2023-02-28 14:21:12 +00:00
Jeff Young 59d8110801 Always highlight children when they're selected on their own.
Fixes https://gitlab.com/kicad/code/kicad/issues/13876

(cherry picked from commit a1ceb585c7)
2023-02-28 14:21:11 +00:00
Jeff Young d028b381fa Make SIM_MODEL_SPICE_FALLBACK act more like the model it's a fallback for.
In particular, install/show the parameters, and keep the existing name
field.

Fixes https://gitlab.com/kicad/code/kicad/issues/14102

(cherry picked from commit 281fde71b9)
2023-02-28 14:21:11 +00:00
Roberto Fernandez Bautista a1a3f810f0 Add missing line from commit b03366c9e8
(cherry picked from commit bb8a3a7fdc)
2023-02-27 23:13:44 +00:00
Roberto Fernandez Bautista c96f0f2396 Fix CADSTAR importer memory leaks
We were leaking the xml tree when throwing exceptions


(cherry picked from commit b03366c9e8)
2023-02-27 22:58:41 +00:00
Fabien Corona 46c8985661 sim - switches: open <-> closed in description 2023-02-27 19:04:48 +01:00
jean-pierre charras c588639503 PANEL_COLOR_SETTINGS: swap swatches and texts to avoid annoying truncation.
In some languages, the texts can be long, and create truncation of the left
column. So if the left column shows swatches they are truncated, or not visible
Truncating long texts is less annoying.
Fixes #14052
https://gitlab.com/kicad/code/kicad/issues/14052
2023-02-27 08:37:13 +01:00
Jeff Young b3c6f559b2 Don't eval empty string.
Fixes https://gitlab.com/kicad/code/kicad/issues/13756

(cherry picked from commit 79f13ea9c7)
2023-02-26 23:14:40 +00:00
Marek Roszko 85544d109c Don't destroy the DIALOG_PCM_PROGRESS until after the threads actually terminated
(cherry picked from commit 47cf26f047)
2023-02-26 22:47:14 +00:00
Jeff Young 4aba595b2b Add second instance of "don't mess up user formatting" fix.
Fixes https://gitlab.com/kicad/code/kicad/issues/13989

(cherry picked from commit 4b427b2d0c)
2023-02-26 22:00:20 +00:00
Jeff Young b2241dca72 Adjust stroke font baseline offset to better match 6.0.
Fixes https://gitlab.com/kicad/code/kicad/issues/13886

(cherry picked from commit 4bb508eacf)
2023-02-26 21:59:43 +00:00
Jeff Young 4ffe742b69 Log new undo record at the start of Change Symbols.
Also fixes a bug where the "screen" variable was used with stale
data.

Fixes https://gitlab.com/kicad/code/kicad/issues/14061

(cherry picked from commit 2b96161d0e)
2023-02-26 21:58:57 +00:00
Jeff Young 5979b8e385 Don't allocate all of memory when the coord system turns inside out.
Fixes https://gitlab.com/kicad/code/kicad/issues/14088

(cherry picked from commit fe9370ceea)
2023-02-26 21:58:08 +00:00
Roberto Fernandez Bautista 955bd5a6d1 CADSTAR Sch: Fix loading of graphical arc shapes
Correctly load arc shapes as real arcs instead of approximating now that
v7 supports graphical arcs in the schematic.

Also fix calculation of arc geometry for ccw arcs.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14101


(cherry picked from commit 698d0b7e92)
2023-02-26 18:47:39 +00:00
qu1ck 1eb8191519 Treat dimensions in fp as text for bbox calculations
(cherry picked from commit 1ff021bb927e9a146f57277554f370f97c07041c)
2023-02-26 17:59:22 +00:00
qu1ck 396bda5611 Sync pcbnew selection with selected items after plugin is run
(cherry picked from commit 9f10c142c4)
2023-02-26 17:58:57 +00:00
Jon Evans cb334be8c4 PNS: Diff pairs can have different hole-to-hole size
Fixes https://gitlab.com/kicad/code/kicad/-/issues/13993


(cherry picked from commit f12f2b8420)
2023-02-26 17:57:47 +00:00
Jon Evans 8845cc0556 PNS: Safety for evaluating item nets for rules
Fixes https://gitlab.com/kicad/code/kicad/-/issues/13993


(cherry picked from commit 459473ccc3)
2023-02-26 17:57:33 +00:00
Jon Evans e34800ad49 Allow shorting copper zones through negative clearance
This brings the zone filler in line with other places where
we use negative clearance rules to disable constraints.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14069


(cherry picked from commit b176881d49)
2023-02-26 17:45:46 +00:00
qu1ck 5b574901b3 Fix swig mappings for PCB_BITMAP
From Master branch.
2023-02-26 10:28:59 +01:00
Alex 59b68154e1 Reduce some flickering in PCM.
(cherry picked from commit b592017495)
2023-02-26 08:34:49 +00:00
jean-pierre charras 5a501c8e48 kicad manager, OnOpenFileInTextEditor(): do not quote the filename.
It will be quoted later.
Fixes #14086
https://gitlab.com/kicad/code/kicad/issues/14086
2023-02-26 08:36:58 +01:00
Seth Hillbrand f927c15adf Prevent mutex deadlock
The overbar function in outline fonts recursively calls the text
function which already owns the lock.  To avoid this, we have an
unlocked variant that is wrapped by the exposed text function

Fixes https://gitlab.com/kicad/code/kicad/issues/14015


(cherry picked from commit 81256c0fa4)
2023-02-25 13:44:18 +00:00
Jon Evans d08157f7db Re-disable validator for VALUE and add comment explaining it 2023-02-25 08:05:42 -05:00
jean-pierre charras 8a9ac4f01f Pcbnew: optimize netname and num text size and position display on pad.
Sizes where a bit too big. Fix also a difference between Cairo and OpenGL.
Fixes #13872
https://gitlab.com/kicad/code/kicad/issues/13872
2023-02-25 11:08:29 +01:00
Jon Evans 39df5f3b15 Do not invalidate board caches during DRC
Footprints now modify their parent container when destroyed due to
26542796, and a temporary footprint is created during DRC
in some situations.  This can lead to board caches being messed
with during DRC which can cause unpredictable bad effects due to
multithreading.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/13844


(cherry picked from commit 8440d7258b)
2023-02-25 03:56:27 +00:00
Jon Evans 981bf328ae Value field needs to use the normal text control
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14056
2023-02-24 22:18:31 -05:00
Jon Evans 1f8e9727b0 Set copper edge clearance to a more reasonable default
(cherry picked from commit 1215a967e2)
2023-02-25 01:43:55 +00:00
Jeff Young f604bcb557 Only write included models if they have overridden parameters.
Fixes https://gitlab.com/kicad/code/kicad/issues/13953

(cherry picked from commit 5a12e5ee76)
2023-02-24 20:47:22 +00:00
Jeff Young eccf9eb4a4 Change strategy for committing values from SIM_MODEL propGrid.
Note that the PCB editor's propGrid doesn't seem to need this workaround,
but I haven't yet figured out what's different between it and the sim model
propGrid.

Fixes https://gitlab.com/kicad/code/kicad/issues/13852

(cherry picked from commit c188318174)
2023-02-24 20:47:22 +00:00
Jeff Young 39403fa885 Cleanup some dead code, and add a potentially needed fix for non-Mac.
(The Mac bug is fixed in 4e5b1da81fce7cd9ffedaec878ed07bfcfff4fe2 in
our wxWidgets fork.)

(cherry picked from commit 200a06a677)
2023-02-24 20:47:22 +00:00
Jeff Young 5e7cc30564 Don't mess up user formatting if eval'ing didn't actually change value.
Fixes https://gitlab.com/kicad/code/kicad/issues/13989

(cherry picked from commit 8059edff0e)
2023-02-24 20:47:22 +00:00
Jeff Young f942b4c657 Don't allow extra text in Sim.* fields.
(In particular, the field name.)

Fixes https://gitlab.com/kicad/code/kicad/issues/13996

(cherry picked from commit 71df3f9edb)
2023-02-24 20:47:22 +00:00
Jeff Young f5aeb5b068 More dead code removal and a bit of formatting and const& for strings.
(cherry picked from commit a126d961d8)
2023-02-24 20:47:22 +00:00
Jeff Young 7f6cb9b07b Remove most of SIM_VALUE in favour of good old wxString.
This allows us to save the user's intent, including units, formatting,
and crucially variable references.

(cherry picked from commit 68fe146861)
2023-02-24 20:47:22 +00:00
Jeff Young db3657d411 Terminology and more dead code.
(cherry picked from commit 29f21cdde6)
2023-02-24 20:47:22 +00:00
Jeff Young 38e5da724d Remove dead and redundant code.
(cherry picked from commit 90adc26b73)
2023-02-24 20:47:22 +00:00
Marco Ciampa 24a63eb304 Updated Italian translation 2023-02-24 14:12:48 +01:00
jean-pierre charras c1f5ae1c5a Plot footprint texts: add code to plot Knockout texts.
Fixes #14068
https://gitlab.com/kicad/code/kicad/issues/14068
2023-02-24 08:49:56 +01:00
Jon Evans 009211c740 Fix some PCB_SHAPE properties
Hide irrelevant position/start/end properties
for shape classes that don't use them.


(cherry picked from commit 1651b44ab1)
2023-02-24 01:24:41 +00:00
Alex 1a208a1612 Print original netnames properly when reconnecting zones/vias.
Using GetNetname() after SetNet() isn't a good idea to get the original
name when updating PCB from Schematic.


(cherry picked from commit 9d96edc44f)
2023-02-23 20:30:39 +00:00
Alex b867e51c6c pcbnew: Fix pads losing nets after Undo.
Wasn't fixed in all places after being broken in
13f5c78e89


(cherry picked from commit f31e5ea783)
2023-02-23 20:30:20 +00:00
qu1ck 7693b93c50 Fix plugins in pcbnew breaking by opening fp editor
From master branch.
2023-02-23 15:31:00 +01:00
jean-pierre charras c3d7158669 Eeschema plot: honor B&W plot option for bitmap images.
Fixes #14013
https://gitlab.com/kicad/code/kicad/issues/14013
2023-02-23 09:53:35 +01:00
Marek Roszko 9f5e50f25e Fix typo in appearance_controls.cpp
(cherry picked from commit c2a4dd93e8)
2023-02-23 01:36:52 +00:00
Jon Evans a091ab76d7 Disable auto-refill zones
We need a more advanced dirtying system for this to work out for
many users, it turns out.  Right now too many changes cause full
zone refills which interrupt workflow.


(cherry picked from commit d8f4d04093)
2023-02-23 01:16:21 +00:00
jean-pierre charras d5eb242295 Fix incorrect tilt of italic texts when plotting them.
Fixes #14023
https://gitlab.com/kicad/code/kicad/issues/14023
2023-02-22 20:25:25 +01:00
Salvador E. Tropea b21e65fc5f Fix compatibility with wxWidgets 3.0.x
- Use CanonicalName when GetCanonicalWithRegion() isn't available
2023-02-22 19:23:55 +00:00
Jeff Young 1b07e81936 Fix compile error on OSX. 2023-02-22 18:06:32 +00:00
Jeff Young 962b2d45ef Implement default levels for JFETs, MOSFETs and MESFETs.
(cherry picked from commit fe2679d965)
2023-02-22 18:04:23 +00:00
Jeff Young 7894b41277 Don't allow 0 field text size.
Fixes https://gitlab.com/kicad/code/kicad/issues/13987

(cherry picked from commit cb71ea872b)
2023-02-22 18:04:23 +00:00
Jeff Young 51d0b8d2b5 Don't allow SCH_LABEL_LOCATE_ANY_T to steal SCH_LABEL_LOCATE_WIRE_T's items.
Fixes https://gitlab.com/kicad/code/kicad/issues/13936

(cherry picked from commit 5967ab9a4d)
2023-02-22 18:04:23 +00:00
Jeff Young 7b992a1dc4 Correctly netlist a voltage source with both AC and DC values.
Fixes https://gitlab.com/kicad/code/kicad/issues/13912

(cherry picked from commit c618bb7046)
2023-02-22 18:04:21 +00:00
Jeff Young 2f8615c6c4 Don't use the just-in-time model resolver when updating the dialog.
If it changes in the middle it will leave you in a world of hurt.

Also don't update the library after a loss-of-focus unless the path
really changed.

Fixes https://gitlab.com/kicad/code/kicad/issues/13869

Fixes https://gitlab.com/kicad/code/kicad/issues/13854

(cherry picked from commit 64f1808d60)
2023-02-22 17:53:10 +00:00
Salvador E. Tropea aee6d9d01c Create the built-in colors in the constructor
This is needed so Python scripts can get built-in colors using the
SETTINGS_MANAGER.GetColorSettings() member.
Otherwise calling it with a built-in name crashes.
2023-02-22 09:12:22 -03:00
Marek Roszko fd4a0dbedf Fix up handling of font names available in multiple names
ttf fonts can declare multiple language names. Many by default opt to just declare one and not tag it any particular language.
However, there are CJK languages that typically leverage this function the most. They'll tag both a "en" and a cjk lang family name in CJK characters.

To be as user friendly as possible, we need to display said fonts in the CJK languages if KiCad to set to such a locale.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14011


(cherry picked from commit 39e69a3d29)
2023-02-22 01:27:09 +00:00
Marek Roszko 14381ac68a Catch parsing exceptions of the local repository.json
Fixes KICAD-B9


(cherry picked from commit 6029fae30b)
2023-02-21 12:15:09 +00:00
Fabien Corona c00a98fed4 Revert "sim - Remember the option to save powers"
This reverts commit 74dcc1b9d5.
2023-02-20 20:59:52 +01:00
Mark Roszko aab7581909 Fix symbol contributor link
(cherry picked from commit 365c7be4ed)
2023-02-20 19:44:59 +00:00
Fabien Corona 74dcc1b9d5 sim - Remember the option to save powers
Fixes #13978


(cherry picked from commit 2a3b70b7eb)
2023-02-20 19:38:19 +00:00
Fabien Corona 17241b3543 sim - missing assignment 2023-02-20 18:15:37 +01:00
Fabien Corona a4a859f47b sim - Check FindParam() results before using them 2023-02-20 18:14:48 +01:00
Fabien Corona b66ed8bc41 sim - don't write dc parameter twice 2023-02-20 18:13:44 +01:00
Fabien Corona 754feff5e7 sim - allow sources that are both AC and TRAN 2023-02-20 18:12:36 +01:00
Fabien Corona cd1b425a80 sim: VSIN - allow user to specify a phase
TD is not the same as PHASE.
TD is the delay before the source turns on.
PHASE is ... the phase

If only TD is set, the signal starts later, but the phase is still 0 when compared to the t=0 of the simulation.

(cherry picked from commit 39a1b14a0f)
2023-02-20 08:45:09 +00:00
Marek Roszko 187947e8d8 Fix crash deleting project tree items
Fixes sentry KICAD-C2


(cherry picked from commit 7d25b6de87)
2023-02-19 15:12:07 +00:00
Marek Roszko 6b38927123 Fix crash parsing cadstar
Fixes sentry KICAD-B2
2023-02-19 08:11:33 -05:00
Marek Roszko f46e4049b6 Try to prevent a crash in mpFXY::Plot
Fixes sentry kicad-c0
2023-02-19 08:11:27 -05:00
Marek Roszko 0ea8299fa7 Fix copypasta typo in export pos
Fixes https://gitlab.com/kicad/code/kicad/-/issues/13991


(cherry picked from commit 9b708ce6d1)
2023-02-19 05:24:36 +00:00
Marek Roszko 5d793193e0 Fix crash by using a shared_mutex to read/write lock the nickIndex
Fixes sentry kicad-ax
2023-02-18 13:02:25 -05:00
Mark Roszko 62337f75b8 FT_Face is also not thread, protect getTextAsGlyphs
(cherry picked from commit 7b4abb1f7b)
2023-02-17 15:17:11 +00:00
Marek Roszko 4d4fdfff70 freetype is not thread safe, zone filler can trigger multi-thread access
sentry KICAD-B1

https://freetype.org/freetype2/docs/reference/ft2-base_interface.html
[Since 2.5.6] In multi-threaded applications it is easiest to use one FT_Library object per thread.
In case this is too cumbersome, a single FT_Library object across threads is possible also, as long as a mutex lock is used around FT_New_Face and FT_Done_Face.


(cherry picked from commit 65d5b34da3)
2023-02-17 15:17:02 +00:00
Alex b63d0a3138 Keep image sizes when loading/saving 7.0- schematic file formats.
Previously, images were assumed to have 300 PPI density when loading from
schematic, but not after initial placement.


(cherry picked from commit bd4758e4df)
2023-02-17 01:50:01 +00:00
Alex 7949c09183 Prevent ghost image after canceling bitmap placement.
(cherry picked from commit ecb28ddf1c)
2023-02-17 01:49:47 +00:00
Seth Hillbrand 3f535aca8c Fix Ukrainian language name
Should refer to the language not to a Ukrainian person

(cherry picked from commit 576bef4ba0)
2023-02-16 15:11:14 -08:00
Jon Evans 9f44809164 Revert "Handle another case where schematic view was being cleared"
This reverts commit 245ce7259c.
2023-02-16 16:44:30 -05:00
Jon Evans f7ccb18af5 Revert "Symbol editor: stop removing overlay from view"
This reverts commit f36cd60fdb.
2023-02-16 16:44:20 -05:00
Jon Evans cca9945867 Revert "Fix handling of selection overlay in schematic editor"
This reverts commit e2711a6121.

This ended up being too complex for 7.0
2023-02-16 16:43:57 -05:00
Jeff Young f23c6b0c2f Clear dirty flags after a move.
Fixes https://gitlab.com/kicad/code/kicad/issues/11362

(cherry picked from commit 40e1296a8b)
2023-02-16 18:10:26 +00:00
Jeff Young 6d22b8c6ed Negative clearance means test won't run, not rule won't match.
Fixes https://gitlab.com/kicad/code/kicad/issues/13947
2023-02-16 18:10:26 +00:00
Jon Evans 245ce7259c Handle another case where schematic view was being cleared
Fixes https://gitlab.com/kicad/code/kicad/-/issues/13944


(cherry picked from commit ec2fc161e1)
2023-02-16 13:25:44 +00:00
Jon Evans f36cd60fdb Symbol editor: stop removing overlay from view
Fixes https://gitlab.com/kicad/code/kicad/-/issues/13944


(cherry picked from commit 955a5a13eb)
2023-02-16 13:17:34 +00:00
jean-pierre charras 8467e2d376 Pcbnew: Do not change visibility objects when changing Visibility layers
Fixes #13836
https://gitlab.com/kicad/code/kicad/issues/13836
2023-02-16 12:42:25 +01:00
jean-pierre charras 2529918d5f Pcbnew: fix incorrect rotation of thermal spoke for rotated footprints.
If the footprint rotation is not a multiple of 90°, the thermal spokes
were not correctly rotated.
Fixes #13919
https://gitlab.com/kicad/code/kicad/issues/13919
2023-02-16 12:41:35 +01:00
Jon Evans e2711a6121 Fix handling of selection overlay in schematic editor
We weren't actually using the overlay group at all

Fixes https://gitlab.com/kicad/code/kicad/-/issues/11142


(cherry picked from commit 0f18a36f8f)
2023-02-16 02:17:36 +00:00
Marek Roszko 89d22e5f94 update sentry-native to 0.6.0
primarily interested in windows bug fix to stack unwinding


(cherry picked from commit 041b7b196d)
2023-02-16 02:10:05 +00:00
jean-pierre charras f13fda9be5 Fix a QA test for bitmaps, to work with latest changes in bitmap code.
cherry pick from 05b68413f7
2023-02-15 15:56:12 +01:00
Ian McInerney 49f6a63a06 Fix compatibility with older wx versions
ToInt was only added in wx 3.1.6 apparently, so for now make them long
types. Fixes bug introduced in 1e8cc6855d

(Cherry-picked from 2b1040ae67)
2023-02-15 11:49:38 +00:00
Ian McInerney e078fea846 Relax wxPython version mismatch check to major.minor
The previous version check failed when the version was even slightly
different, including on the revision field. Theoretically the ABI of the
wx minor versions in use should be the same, so this might work. On the
other hand, with wxPython it could break as well. YOLO.

(Cherry-picked from 1e8cc6855d)
2023-02-15 11:49:15 +00:00
Ian McInerney 048c8b1670 Support subrelease field in wxWidgets cmake detection
Sometimes wxWidgets increments the subrelease to a non-zero value, and
since wxPython will report a subrelease, we must ensure we can get the
subrelease from the wx library properly, otherwise configure will fail
thinking the library isn't the same version as that used by wxPython.

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/13887

(Cherry-picked from b536580119)
2023-02-15 11:48:53 +00:00
Marek Roszko 3b5c38d861 CURLINFO_SIZE_DOWNLOAD_T is a enum entry, use the version check instead
(cherry picked from commit c189053ee5)
2023-02-15 04:45:22 +00:00
Marek Roszko 90fb075e34 CURLOPT_XFERINFOFUNCTION is an enum entry not a define, the check is invalid
(cherry picked from commit 94b5ddbb50)
2023-02-15 04:26:51 +00:00
Jon Evans 08c6d9ce96 Set PPI properly in schematic bitmaps, too
(cherry picked from commit e8a88411ea)
2023-02-15 02:37:22 +00:00
Marek Roszko 76ccb8c31f Try and avoid crashing on gl context creation failure in the 3d viewer
Sentry event id 0ad4afa6b86a4a03ad7f8fdbcdb72f86


(cherry picked from commit 5ccf205788)
2023-02-15 02:20:14 +00:00
Jon Evans 3dfc502814 Router: Do not collide items within a net tie footprint
Fixes https://gitlab.com/kicad/code/kicad/-/issues/13909

(cherry picked from commit 2d7c5c5c0f)
2023-02-14 21:10:42 -05:00
Jon Evans df0f626283 Properties: remove assertion that no longer makes sense
(cherry picked from commit e5b376721d)
2023-02-14 21:10:42 -05:00
Jon Evans 1909ce9220 Properties: fix rebuilding when availability changes
(cherry picked from commit 61dd4b7043)
2023-02-14 21:10:42 -05:00
Jon Evans 15bef82e1e Properties: add some validators for PAD
(cherry picked from commit 0b3928d38f)
2023-02-14 21:10:42 -05:00
Jon Evans 60a45241e6 Properties: introduce validators; re-enable zone hatch settings
(cherry picked from commit eb240fda9a)
2023-02-14 21:10:42 -05:00
Jon Evans d403e92315 Properties: introduce method chaining for initialization
(cherry picked from commit 254168c788)
2023-02-14 21:10:42 -05:00
Marek Roszko eed7ede376 Fix step colors some more
Fixes https://gitlab.com/kicad/code/kicad/-/issues/13611

I need to refactor the overall structure and know what to do, but ugh lazy


(cherry picked from commit c6540575b5)
2023-02-15 00:45:17 +00:00
Jon Evans d20f49b58b Fix handling of PPI when loading embedded images
Fixes https://gitlab.com/kicad/code/kicad/-/issues/13884


(cherry picked from commit 473979d686)
2023-02-15 00:42:30 +00:00
Jon Evans 37091df142 Symbol chooser: save UI settings even when canceled
Fixes https://gitlab.com/kicad/code/kicad/-/issues/13903

(cherry picked from commit 29c4482bc8)
2023-02-14 18:27:31 -05:00
Jon Evans 21081cf80f Handle custom columns in symbol tree synchronizing adapter
Fixes https://gitlab.com/kicad/code/kicad/-/issues/13907

(cherry picked from commit 0913552f84)
2023-02-14 18:27:21 -05:00
Mark Roszko c213b37e96 Update 2 files
- /vcpkg-configuration.json
- /vcpkg.json
2023-02-14 23:12:05 +00:00
Seth Hillbrand d1ca84aa43 Don't desaturate the selection shadow
Selection shadows are helpful when showing which elements are selected
and there is no benefit (and some downside) to having their color
removed.

Fixes https://gitlab.com/kicad/code/kicad/issues/13878

(cherry picked from commit 9f8b25a0b0)
2023-02-14 10:22:49 -08:00
Wayne Stambaugh 0f7fbc411a Allow plotting of multiple board layers per plot in Python.
Since the always plot the edge cuts layer  option was deprecate,
the ability to plot multiple board layers was exposed through the
PLOT_CONTROLLER object.

Added the interactive plot information which was overlooked during
version 7 development.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/13841

(cherry picked from commit eb83f76bff)
2023-02-14 09:53:16 -05:00
Jeff Young f4b2b1b03f Workaround wxWidgets enforced min pen width by using transparent pen.
Also fixes some bugs in our shape printing code when a border is not
specified but a fill is.

Fixes https://gitlab.com/kicad/code/kicad/issues/13891

(cherry picked from commit 03484aedbc)
2023-02-14 14:45:24 +00:00
Marek Roszko 0ecc36c4a5 Fix step model colors again
Fixes https://gitlab.com/kicad/code/kicad/-/issues/13882


(cherry picked from commit df022acc11)
2023-02-14 03:23:06 +00:00
Marek Roszko a48eace90a It's not impossible for the font face to fail loading
LoadFont()'s only usage already checked for nullptr to fallback, let's actually return nullptr on a failed load

Fixes sentry KICAD-8Z
Make the cause of sentry KICAD-95


(cherry picked from commit e8e407dfba)
2023-02-14 01:09:56 +00:00
Marek Roszko 7a2a51ad44 Prevent another GAL crash on init due to psuedo-race
Fixes Sentry KICAD-98


(cherry picked from commit 9647a22e50)
2023-02-14 00:11:15 +00:00
Seth Hillbrand f56fcb0a14 Better handling of vertex sorting
Nominally, the zcode of a vertex is unique.  This is not 100% true,
however, as we must interlace two 32-bit numbers into a single 32-bit
number.  Sorting needs to account for the possibility that the zcode
will be the same while other elements of the vertex are different.  This
commit fixes the broken boolean logic to more clearly handle these cases

Fixes https://gitlab.com/kicad/code/kicad/issues/13867

(cherry picked from commit e7fe69b97f)
2023-02-13 11:23:14 -08:00
Jeff Young 7816652078 Account for border when calculating text margin for text boxes.
Also fixes some unnoticed issues with the textbox dialogs (probably
dating from the move to wxWidgets 3.2).

Fixes https://gitlab.com/kicad/code/kicad/issues/13877
2023-02-13 17:07:42 +00:00
Jeff Young 20aacc7026 Don't confuse .OP with .OPTIONS.
Fixes https://gitlab.com/kicad/code/kicad/issues/13849

(cherry picked from commit d6bef19811)
2023-02-13 13:34:40 +00:00
Jeff Young 49938cfd09 Fix layout issue in IBIS fields. 2023-02-13 12:42:42 +00:00
Jeff Young 53a4ed6b24 ReadDataFields must be a separate step from Create.
Create() is done without execption processing, while ReadDataFields
should have exception processing.

(This also fixes a case where exception processing on ReadDataFields
was missing.)

Also fixes a bug where the pinSelect menu wasn't checked for -1 before
fetching.

Fixes https://gitlab.com/kicad/code/kicad/issues/13856
2023-02-13 12:42:42 +00:00
Marek Roszko 534000b49d Ensure gal is initialized before letting DoRepaint blowup spectacularly.
Maybe a fix for KICAD-6B


(cherry picked from commit 58350b4521)
2023-02-13 12:21:44 +00:00
Jeff Young 7e2ccbf909 Prepend correct SPICE prefix when necessary for plotting currents.
Fixes https://gitlab.com/kicad/code/kicad/issues/13850

(cherry picked from commit a22964a977)
2023-02-13 10:59:32 +00:00
Jeff Young b0b6968185 Fix too-narrow text edit control on Mac.
Also makes the yellow error highlight in CvPCB a bit less jarring.

Fixes https://gitlab.com/kicad/code/kicad/issues/13866

(cherry picked from commit 77421c8fb6)
2023-02-13 10:56:55 +00:00
Jeff Young 94963b5b3a Remove DRC exclusions that no longer have items.
Fixes https://gitlab.com/kicad/code/kicad/issues/13802

(cherry picked from commit 13391176ae)
2023-02-13 10:55:07 +00:00
Jeff Young 77fa61e6fc Make sure screen RTrees are updated when changing bounding boxes.
(cherry picked from commit 7bc79c17d4)
2023-02-13 10:54:59 +00:00
Jeff Young 94c450ad16 Bug fixes for LIB_PIN boundbox generation.
(cherry picked from commit 9ce5978c3d)
2023-02-13 10:54:55 +00:00
Jeff Young a292bf7c83 Don't dirty connectivity when moving non-reference SCH_FIELD.
(cherry picked from commit 2e9ed67e05)
2023-02-13 10:54:49 +00:00
Marek Roszko b24ee1c44f Prevent a crash when a spice SW_I lacks two pin net names
Fixes KICAD-5D


(cherry picked from commit 2cc3d8e9bc)
2023-02-13 03:32:07 +00:00
Jon Evans 981b22ba49 Add initial sections to bare template
(cherry picked from commit 12a9ed0208)
2023-02-11 12:04:45 -05:00
Jon Evans e1eedd3bba Attempt to fix GitLab template duplication
(cherry picked from commit 609ef96e42)
2023-02-11 12:04:39 -05:00
Wayne Stambaugh b949fd4d43 Begin 7.0.1 development. 2023-02-11 11:36:50 -05:00
8166 changed files with 1508595 additions and 7245630 deletions
-4
View File
@@ -30,7 +30,3 @@ bitmaps_png/cpp_*/*.cpp generated
# Lemon grammars
common/libeval/grammar.c generated
common/libeval/grammar.h generated
# Scripts
*.sh text eol=lf
*.bat text eol=crlf
+2 -2
View File
@@ -1,2 +1,2 @@
custom: "https://donate.kicad.org"
community_bridge: kicad
community_bridge: kicad
custom: "https://donate.cernandsocietyfoundation.cern/b/my-donation?cid=4&_cv=1"
+3 -5
View File
@@ -1,8 +1,8 @@
.downloads-by-cmake
.gdb_history
boost_root
/Build*
/build*
/Build
/build
/cmake-build-*
common/fp_lib_table_keywords.cpp
common/drc_rules_keywords.cpp
@@ -27,11 +27,11 @@ eeschema/schematic_keywords.*
pcbnew/pcb_plot_params_keywords.cpp
pcbnew/pcb_plot_params_lexer.h
Makefile
CMakeUserPresets.json
CMakeCache.txt
.cache/
auto_renamed_to_cpp
Testing
version.h
config.h
install_manifest.txt
doxygen/out
@@ -52,7 +52,6 @@ bitmaps_png/tmp
common/pcb_keywords.cpp
include/pcb_lexer.h
fp-info-cache
qa/tests/output/**
# demo project auxiliary files
demos/**/*-bak
@@ -103,7 +102,6 @@ __pycache__
.editorconfig
CMakeSettings.json
.vscode/
/vcpkg_installed
# Sublime Text
*.sublime-*
+30 -2
View File
@@ -8,13 +8,41 @@ default:
name: registry.gitlab.com/kicad/kicad-ci/source_containers/master/fedora:36
entrypoint: ["/bin/sh", "-c"]
##########################################################################
# Test the formatting in a merge request using clang-format
##########################################################################
# The variable CI_COMMIT_BEFORE_SHA is not available in normal merge requests
# so we must build the commit hash ourselves, see:
# https://gitlab.com/gitlab-org/gitlab/-/issues/12850
test_formatting:
stage: test
needs: []
only:
- merge_requests
allow_failure: true
before_script:
# We must manually add the KiCad remote to ensure it is named sensibly
- git remote add product https://gitlab.com/kicad/code/kicad.git ||
git remote set-url product https://gitlab.com/kicad/code/kicad.git
- git remote add source ${CI_MERGE_REQUEST_SOURCE_PROJECT_URL}.git ||
git remote set-url source ${CI_MERGE_REQUEST_SOURCE_PROJECT_URL}.git
- git fetch -n product
- git fetch -n source
# Get the SHAs of the commits
- "TARGET_HEAD_SHA=$(git rev-parse product/${CI_MERGE_REQUEST_TARGET_BRANCH_NAME})"
- "SOURCE_HEAD_SHA=$(git rev-parse source/${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME})"
- "MERGE_BASE_SHA=$(git merge-base ${TARGET_HEAD_SHA} ${SOURCE_HEAD_SHA})"
script:
- echo "Testing formatting from commit ${MERGE_BASE_SHA}"
- ./tools/check_coding.sh --diff --ci --commit ${MERGE_BASE_SHA}
include:
- local: '/.gitlab/templates.yml'
- local: '/.gitlab/Fedora-Linux-CI.yml'
- local: '/.gitlab/Ubuntu-20.04-CI.yml'
- local: '/.gitlab/Windows-CI.yml'
- local: '/.gitlab/macOS-CI.yml'
- local: '/.gitlab/coverity.yml'
- local: '/.gitlab/linux-metadata-validate.yml'
- local: '/.gitlab/doxygen.yml'
- local: '/.gitlab/mr_formatting.yml'
+4 -12
View File
@@ -6,7 +6,7 @@
# Don't tag until we have separate CI for MRs
# tags:
# - kicad-fedora
image: registry.gitlab.com/kicad/kicad-ci/source_containers/master/fedora:38
image: registry.gitlab.com/kicad/kicad-ci/source_containers/master/fedora:37
extends: .only_code
interruptible: false
cache:
@@ -25,9 +25,8 @@
-G Ninja
-DCMAKE_BUILD_TYPE=QABUILD
-DKICAD_STDLIB_LIGHT_DEBUG=ON
-DKICAD_SPICE=ON
-DKICAD_BUILD_I18N=ON
-DKICAD_TEST_XML_OUTPUT=ON
-DKICAD_BUILD_PNS_DEBUG_TOOL=ON
../../
- ninja 2>&1 | tee compilation_log.txt
- cd ../../
@@ -39,10 +38,6 @@
when: always
paths:
- build/linux/3d-viewer/
- build/linux/common/libkicommon.so*
- build/linux/common/gal/libkigal.so*
- build/linux/eeschema/_eeschema.kiface
- build/linux/kicad/kicad-cli
- build/linux/pcbnew/pcbnew.py
- build/linux/pcbnew/_pcbnew.kiface
- build/linux/pcbnew/_pcbnew.so
@@ -140,17 +135,14 @@ fedora_report_metrics_public:
# Run the code unit tests.
##########################################################################
.fedora_qa:
image: registry.gitlab.com/kicad/kicad-ci/source_containers/master/fedora:38
image: registry.gitlab.com/kicad/kicad-ci/source_containers/master/fedora:37
extends:
- .unit_test
- .only_code
before_script:
- if [ "$TEST" == "cli" ] || [ "$TEST" == "python" ]; then python3 -m pip install -r qa/tests/requirements.txt; fi
- if [ "$TEST" == "cli" ]; then sudo dnf -y install gerbv; fi
parallel:
matrix:
# The name of the test without the qa_ prefix
- TEST: [python, cli, common, gerbview, pcbnew, pns_regressions, eeschema, kimath, sexpr, kicad2step, spice]
- TEST: [python, common, gerbview, pcbnew, eeschema, kimath, sexpr, kicad2step]
fedora_qa_kicad:
extends: .fedora_qa
+2 -1
View File
@@ -32,6 +32,7 @@
-DKICAD_STDLIB_LIGHT_DEBUG=ON
-DKICAD_SCRIPTING_WXPYTHON=ON
-DKICAD_USE_OCC=ON
-DKICAD_SPICE=ON
-DKICAD_BUILD_I18N=ON
-DKICAD_BUILD_PNS_DEBUG_TOOL=ON
../../
@@ -115,4 +116,4 @@
parallel:
matrix:
# The name of the test without the qa_ prefix
- TEST: [python, common, gerbview, pcbnew, eeschema, kimath, sexpr, kicad2step, spice]
- TEST: [python, common, gerbview, pcbnew, eeschema, kimath, sexpr, kicad2step]
+5 -7
View File
@@ -5,22 +5,19 @@ win64_build:
stage: build
tags:
- kicad-windows-1809
extends: .only_code
interruptible: false
image: registry.gitlab.com/kicad/kicad-ci/windows-build-image/win1809-msvc:latest
variables:
VCPKG_BINARY_SOURCES: 'nuget,kicad,readwrite'
# Switch the compressor to fastzip and reduce the compression level
FF_USE_FASTZIP: "true"
CACHE_COMPRESSION_LEVEL: "fast"
cache:
key: win64-vcpkg-"$CI_COMMIT_REF_SLUG"
paths:
- build\windows\vcpkg_installed
- .vcpkgCache
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
when: never
- if: $CI_PROJECT_ROOT_NAMESPACE == "kicad" && $CI_COMMIT_REF_PROTECTED == "true"
only:
- branches@kicad/code/kicad
- tags@kicad/code/kicad
script:
- C:\builder\build.ps1 -Env -Arch x64
- $vcpkgCache=Join-Path -Path (Get-Location) -ChildPath ".vcpkgCache";$env:VCPKG_DEFAULT_BINARY_CACHE=$vcpkgCache;New-Item -ItemType Directory -Force -Path $vcpkgCache
@@ -34,6 +31,7 @@ win64_build:
-DCMAKE_BUILD_TYPE=Debug `
-DKICAD_SCRIPTING_WXPYTHON=OFF `
-DKICAD_USE_OCC=ON `
-DKICAD_SPICE=ON `
-DKICAD_BUILD_PNS_DEBUG_TOOL=ON `
-DKICAD_USE_3DCONNEXION=ON `
../../
+12 -17
View File
@@ -22,16 +22,13 @@
# These results will be saved for 1 day if the build fails.
.coverity_submit: &coverity_submit |
echo "Creating tar file of scan results"
export COV_INT_FILENAME=cov-int-$(date +"%Y%m%d%H%M").tar.gz
tar cfz $COV_INT_FILENAME cov-int
tar cfz cov-int.tar.gz cov-int
echo "Submitting scan results"
s5cmd/s5cmd cp $COV_INT_FILENAME s3://$KICAD_CI_R2_BUCKET/coverity/
export FILE_URL="$KICAD_CI_R2_PUBLIC_BASE/coverity/$COV_INT_FILENAME"
export KICAD_VERSION=$(sed 's/[()]//g' kicad_build_version.txt)
curl https://scan.coverity.com/builds?project=$COVERITY_SCAN_PROJECT_NAME \
--form token=$COVERITY_SCAN_TOKEN \
--form email=$GITLAB_USER_EMAIL \
--form url="$FILE_URL" \
--form file=@cov-int.tar.gz \
--form version="$KICAD_VERSION" \
--form description="$KICAD_VERSION / $CI_COMMIT_TITLE" 2>&1 \
| tee curl-response.txt
@@ -42,9 +39,12 @@ Coverity:
tags:
- coverity
stage: build
image: registry.gitlab.com/kicad/kicad-ci/source_containers/master/fedora:38
rules:
- if: $CI_PIPELINE_SOURCE == "schedule" && $SCHEDULED_JOB_NAME == "coverity"
image: registry.gitlab.com/kicad/kicad-ci/source_containers/master/fedora:37
only:
refs:
- schedules
variables:
- $SCHEDULED_JOB_NAME == "coverity"
cache:
key: coverity
paths:
@@ -53,23 +53,18 @@ Coverity:
- export COVERITY_SCAN_PROJECT_NAME="kicad"
- test "$(git rev-parse --is-shallow-repository)" = "false" || (git fetch --unshallow)
- git fetch origin
- curl -LO https://github.com/peak/s5cmd/releases/download/v2.0.0/s5cmd_2.0.0_Linux-64bit.tar.gz
- mkdir s5cmd
- tar -xvf ./s5cmd_2.0.0_Linux-64bit.tar.gz -C s5cmd
- export AWS_ACCESS_KEY_ID=$KICAD_CI_R2_KEY_ID
- export AWS_SECRET_ACCESS_KEY=$KICAD_CI_R2_ACCESS_KEY
- export S3_ENDPOINT_URL=$KICAD_CI_R2_ENDPOINT
script:
- *coverity_cache_prep
- cmake
-DCMAKE_BUILD_TYPE=RelWithDebInfo
-DCMAKE_BUILD_TYPE=Debug
-DKICAD_STDLIB_LIGHT_DEBUG=ON
-DKICAD_SCRIPTING_WXPYTHON=ON
- coverity/bin/cov-build --dir cov-int make -j10
-DKICAD_SPICE=ON
- coverity/bin/cov-build --dir cov-int make -j8
- *coverity_submit
artifacts:
expire_in: 1 year
expose_as: 'Coverity log'
name: "coverity_log.txt"
paths:
- cov-int/build-log.txt
- cov-int/build-log.txt
+5 -2
View File
@@ -3,8 +3,6 @@ build_doxygen_docker:
services:
- docker:dind
stage: build
rules:
- if: $CI_PIPELINE_SOURCE == "schedule" && $SCHEDULED_JOB_NAME == "doxygen"
tags:
- docker
before_script:
@@ -13,3 +11,8 @@ build_doxygen_docker:
script:
- docker build -t "${CI_REGISTRY_IMAGE}/doxygen:$CI_COMMIT_BRANCH" -f ./doxygen/doxygen.Dockerfile .
- docker push "${CI_REGISTRY_IMAGE}/doxygen:$CI_COMMIT_BRANCH"
only:
refs:
- schedules
variables:
- $SCHEDULED_JOB_NAME == "doxygen"
+15 -9
View File
@@ -6,18 +6,23 @@ validate_linux_metadata:
needs: []
interruptible: false
# This is the only CI image with the utilities needed for this test
image: registry.gitlab.com/kicad/kicad-ci/source_containers/master/fedora:38
image: registry.gitlab.com/kicad/kicad-ci/source_containers/master/fedora:37
# Due to bug https://github.com/hughsie/appstream-glib/issues/381, this doesn't think our description tag
# is localized even though it actually is.
allow_failure: true
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
when: never
- if: $CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "merge_request_event"
changes:
- resources/linux/**/*
- qa/resources/linux/**/*
- translation/**/*
only:
refs:
- master
- branches
- merge_requests
- pushes
changes:
# Only run if the resources, its tests, or the translations are updated
- resources/linux/**/*
- qa/resources/linux/**/*
- translation/**/*
except:
- schedules
# Only build the metadata files in this CI job
script:
- mkdir -p build/linux
@@ -26,6 +31,7 @@ validate_linux_metadata:
-DCMAKE_BUILD_TYPE=Debug
-DKICAD_STDLIB_LIGHT_DEBUG=ON
-DKICAD_SCRIPTING_WXPYTHON=ON
-DKICAD_SPICE=ON
-DKICAD_BUILD_I18N=ON
../../
- make metadata
-47
View File
@@ -1,47 +0,0 @@
##########################################################################
# Build KiCad on Windows and save the results
##########################################################################
macos_build:
stage: build
tags:
- kicad-macos
interruptible: false
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
when: never
- if: $CI_PROJECT_ROOT_NAMESPACE == "kicad" && $CI_COMMIT_REF_PROTECTED == "true"
script:
- mkdir -p build/macos
- cd build/macos
- cmake
-G Ninja
-DCMAKE_BUILD_TYPE=RelWithDebInfo
-DDEFAULT_INSTALL_PATH=/Library/Application\ Support /kicad
-DOCC_INCLUDE_DIR=/opt/homebrew/Cellar/opencascade/7.7.2_2/include/opencascade
-DOCC_LIBRARY_DIR=/opt/homebrew/Cellar/opencascade/7.7.2_2/Lib
-DCMAKE_INSTALL_PREFIX=/Users/ci/kicad-mac-builder/build/kicad-dest
-DCMAKE_C_COMPILER=/usr/bin/clang
-DCMAKE_CXX_COMPILER=/usr/bin/clang++
-DwxWidgets_CONFIG_EXECUTABLE=/Users/ci/kicad-mac-builder/build/wxwidgets-dest/bin/wx-config
-DKICAD_BUILD_I18N=ON
-DKICAD_SCRIPTING_WXPYTHON=ON
-DKICAD_BUILD_PNS_DEBUG_TOOL=ON
-DPYTHON_EXECUTABLE=/Users/ci/kicad-mac-builder/build/python-dest/Library/Frameworks/Python.framework/Versions/Current/bin/python3
-DPYTHON_INCLUDE_DIR=/Users/ci/kicad-mac-builder/build/python-dest/Library/Frameworks/Python.framework/Versions/Current/include/python3.9/
-DPYTHON_LIBRARY=/Users/ci/kicad-mac-builder/build/python-dest/Library/Frameworks/Python.framework/Versions/Current/lib/libpython3.9.dylib
-DPYTHON_SITE_PACKAGE_PATH=/Users/ci/kicad-mac-builder/build/python-dest/Library/Frameworks/Python.framework/Versions/Current/lib/python3.9/site-packages
-DPYTHON_FRAMEWORK=/Users/ci/kicad-mac-builder/build/python-dest/Library/Frameworks/Python.framework
-DNGSPICE_INCLUDE_DIR=/Users/ci/kicad-mac-builder/build/ngspice-dest/include
-DNGSPICE_LIBRARY=/Users/ci/kicad-mac-builder/build/ngspice-dest/lib/libngspice.dylib
-DKICAD_USE_3DCONNEXION=ON
../../
- cmake --build . 2>&1 | tee compilation_log.txt
- cd ../../
artifacts:
# Only save the artifacts that are needed for running the tests in the next stage
# and the compilation log. The entire build directory is too large to save as an
# artifact.
expire_in: 2 hrs
when: always
paths:
- build/macos/compilation_log.txt
+2 -4
View File
@@ -12,10 +12,8 @@ test_formatting:
allow_failure: true
before_script:
# We must manually add the KiCad remote to ensure it is named sensibly
- git remote add product https://gitlab.com/kicad/code/kicad.git ||
git remote set-url product https://gitlab.com/kicad/code/kicad.git
- git remote add source ${CI_MERGE_REQUEST_SOURCE_PROJECT_URL}.git ||
git remote set-url source ${CI_MERGE_REQUEST_SOURCE_PROJECT_URL}.git
- git remote add product https://gitlab.com/kicad/code/kicad.git
- git remote add source ${CI_MERGE_REQUEST_SOURCE_PROJECT_URL}.git
- git fetch -n product
- git fetch -n source
# Get the SHAs of the commits
+10 -10
View File
@@ -17,21 +17,21 @@
.unit_test:
stage: test
when: on_success
variables:
BOOST_TEST_LOGGER: 'JUNIT,warning,test_results.${TEST}.xml:HRF,warning'
CTEST_OUTPUT_ON_FAILURE: 1
# We define this using a before script because GitLab cannot merge variable
# definitions across inheritance (so the variables block from this would disappear)
before_script:
- export BOOST_TEST_LOGGER='JUNIT,all,test_results.${TEST}.xml:HRF,warning'
- export CTEST_OUTPUT_ON_FAILURE=1
script:
- cd build/linux/qa
- ctest -R qa_${TEST}
# GitLab supports displaying the results in the GUI through JUNIT artifacts
# (https://docs.gitlab.com/ee/ci/junit_test_reports.html)
# so we upload the JUNIT results.
# so we upload the JUNIT results. Note that there is a bug with how paths
# are processed in the junit report (https://gitlab.com/gitlab-org/gitlab/-/issues/23835)
# so we can't use a glob and have to list out each hierarchy separately.
artifacts:
when: always
paths:
- build/linux/qa/**/*.log
- build/linux/qa/**/output/*
- build/linux/qa/**/*.xml
reports:
junit:
- build/linux/qa/**/*.xml
- build/linux/qa/*/*.xml
- build/linux/qa/*/*/*.xml
+61 -1
View File
@@ -61,6 +61,7 @@
#define MASK_3D_CACHE "3D_CACHE"
static std::mutex mutex3D_cache;
static std::mutex mutex3D_cacheManager;
static bool isSHA1Same( const unsigned char* shaA, const unsigned char* shaB ) noexcept
@@ -696,4 +697,63 @@ void S3D_CACHE::CleanCacheDir( int aNumDaysOld )
}
}
}
}
}
void PROJECT::Cleanup3DCache()
{
std::lock_guard<std::mutex> lock( mutex3D_cacheManager );
// Get the existing cache from the project
S3D_CACHE* cache = dynamic_cast<S3D_CACHE*>( GetElem( ELEM_3DCACHE ) );
if( cache )
{
// We'll delete ".3dc" cache files older than this many days
int clearCacheInterval = 0;
if( Pgm().GetCommonSettings() )
clearCacheInterval = Pgm().GetCommonSettings()->m_System.clear_3d_cache_interval;
// An interval of zero means the user doesn't want to ever clear the cache
if( clearCacheInterval > 0 )
cache->CleanCacheDir( clearCacheInterval );
}
}
S3D_CACHE* PROJECT::Get3DCacheManager( bool aUpdateProjDir )
{
std::lock_guard<std::mutex> lock( mutex3D_cacheManager );
// Get the existing cache from the project
S3D_CACHE* cache = dynamic_cast<S3D_CACHE*>( GetElem( ELEM_3DCACHE ) );
if( !cache )
{
// Create a cache if there is not one already
cache = new S3D_CACHE();
wxFileName cfgpath;
cfgpath.AssignDir( SETTINGS_MANAGER::GetUserSettingsPath() );
cfgpath.AppendDir( wxT( "3d" ) );
cache->SetProgramBase( &Pgm() );
cache->Set3DConfigDir( cfgpath.GetFullPath() );
SetElem( ELEM_3DCACHE, cache );
aUpdateProjDir = true;
}
if( aUpdateProjDir )
cache->SetProject( this );
return cache;
}
FILENAME_RESOLVER* PROJECT::Get3DFilenameResolver()
{
return Get3DCacheManager()->GetResolver();
}
+2 -2
View File
@@ -91,7 +91,7 @@ endif()
unset( S3DSG_VERSION_FILE CACHE )
# Define a flag to expose the appropriate EXPORT macro at build time
target_compile_definitions( kicad_3dsg PRIVATE COMPILE_SGLIB )
target_compile_definitions( kicad_3dsg PRIVATE -DCOMPILE_SGLIB )
target_link_libraries( kicad_3dsg ${wxWidgets_LIBRARIES} )
@@ -108,4 +108,4 @@ install( TARGETS
if( KICAD_WIN32_INSTALL_PDBS )
# Get the PDBs to copy over for MSVC
install(FILES $<TARGET_PDB_FILE:kicad_3dsg> DESTINATION ${KICAD_BIN})
endif()
endif()
+121 -342
View File
@@ -1,9 +1,8 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2015-2023 Mario Luzeiro <mrluzeiro@ua.pt>
* Copyright (C) 2023 CERN
* Copyright (C) 1992-2024 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2015-2022 Mario Luzeiro <mrluzeiro@ua.pt>
* Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -23,7 +22,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <gal/3d/camera.h>
#include "../3d_rendering/camera.h"
#include "board_adapter.h"
#include <board_design_settings.h>
#include <board_stackup_manager/board_stackup.h>
@@ -50,7 +49,7 @@
#define SOLDERPASTE_LAYER_THICKNESS pcbIUScale.mmToIU( 0.04 )
CUSTOM_COLORS_LIST BOARD_ADAPTER::g_SilkColors;
CUSTOM_COLORS_LIST BOARD_ADAPTER::g_SilkscreenColors;
CUSTOM_COLORS_LIST BOARD_ADAPTER::g_MaskColors;
CUSTOM_COLORS_LIST BOARD_ADAPTER::g_PasteColors;
CUSTOM_COLORS_LIST BOARD_ADAPTER::g_FinishColors;
@@ -63,8 +62,6 @@ KIGFX::COLOR4D BOARD_ADAPTER::g_DefaultSolderMask;
KIGFX::COLOR4D BOARD_ADAPTER::g_DefaultSolderPaste;
KIGFX::COLOR4D BOARD_ADAPTER::g_DefaultSurfaceFinish;
KIGFX::COLOR4D BOARD_ADAPTER::g_DefaultBoardBody;
KIGFX::COLOR4D BOARD_ADAPTER::g_DefaultComments;
KIGFX::COLOR4D BOARD_ADAPTER::g_DefaultECOs;
// To be used in Raytracing render to create bevels on layer items
float g_BevelThickness3DU = 0.0f;
@@ -89,6 +86,7 @@ BOARD_ADAPTER::BOARD_ADAPTER() :
m_IsPreviewer( false ),
m_board( nullptr ),
m_3dModelManager( nullptr ),
m_renderSettings( nullptr ),
m_colors( nullptr ),
m_layerZcoordTop(),
m_layerZcoordBottom()
@@ -103,9 +101,9 @@ BOARD_ADAPTER::BOARD_ADAPTER() :
m_boardBoundingBox.Reset();
m_TH_IDs.Clear();
m_TH_ODs.Clear();
m_viaAnnuli.Clear();
m_throughHoleIds.Clear();
m_throughHoleOds.Clear();
m_throughHoleAnnularRings.Clear();
m_copperLayersCount = 2;
@@ -132,34 +130,26 @@ BOARD_ADAPTER::BOARD_ADAPTER() :
m_SilkScreenColorTop = SFVEC4F( 0.9, 0.9, 0.9, 1.0 );
m_SilkScreenColorBot = SFVEC4F( 0.9, 0.9, 0.9, 1.0 );
m_CopperColor = SFVEC4F( 0.75, 0.61, 0.23, 1.0 );
m_UserDrawingsColor = SFVEC4F( 0.85, 0.85, 0.85, 1.0 );
m_UserCommentsColor = SFVEC4F( 0.85, 0.85, 0.85, 1.0 );
m_ECO1Color = SFVEC4F( 0.70, 0.10, 0.10, 1.0 );
m_ECO2Color = SFVEC4F( 0.70, 0.10, 0.10, 1.0 );
m_platedPadsFront = nullptr;
m_platedPadsBack = nullptr;
m_offboardPadsFront = nullptr;
m_offboardPadsBack = nullptr;
m_frontPlatedPadAndGraphicPolys = nullptr;
m_backPlatedPadAndGraphicPolys = nullptr;
m_frontPlatedCopperPolys = nullptr;
m_backPlatedCopperPolys = nullptr;
m_frontPlatedPadPolys = nullptr;
m_backPlatedPadPolys = nullptr;
if( !g_ColorsLoaded )
{
#define ADD_COLOR( list, r, g, b, a, name ) \
list.emplace_back( r/255.0, g/255.0, b/255.0, a, name )
ADD_COLOR( g_SilkColors, 245, 245, 245, 1.0, NotSpecifiedPrm() ); // White
ADD_COLOR( g_SilkColors, 20, 51, 36, 1.0, wxT( "Green" ) );
ADD_COLOR( g_SilkColors, 181, 19, 21, 1.0, wxT( "Red" ) );
ADD_COLOR( g_SilkColors, 2, 59, 162, 1.0, wxT( "Blue" ) );
ADD_COLOR( g_SilkColors, 11, 11, 11, 1.0, wxT( "Black" ) );
ADD_COLOR( g_SilkColors, 245, 245, 245, 1.0, wxT( "White" ) );
ADD_COLOR( g_SilkColors, 32, 2, 53, 1.0, wxT( "Purple" ) );
ADD_COLOR( g_SilkColors, 194, 195, 0, 1.0, wxT( "Yellow" ) );
ADD_COLOR( g_SilkscreenColors, 245, 245, 245, 1.0, NotSpecifiedPrm() ); // White
ADD_COLOR( g_SilkscreenColors, 20, 51, 36, 1.0, wxT( "Green" ) );
ADD_COLOR( g_SilkscreenColors, 181, 19, 21, 1.0, wxT( "Red" ) );
ADD_COLOR( g_SilkscreenColors, 2, 59, 162, 1.0, wxT( "Blue" ) );
ADD_COLOR( g_SilkscreenColors, 11, 11, 11, 1.0, wxT( "Black" ) );
ADD_COLOR( g_SilkscreenColors, 245, 245, 245, 1.0, wxT( "White" ) );
ADD_COLOR( g_SilkscreenColors, 32, 2, 53, 1.0, wxT( "Purple" ) );
ADD_COLOR( g_SilkscreenColors, 194, 195, 0, 1.0, wxT( "Yellow" ) );
ADD_COLOR( g_MaskColors, 20, 51, 36, 0.83, NotSpecifiedPrm() ); // Green
ADD_COLOR( g_MaskColors, 20, 51, 36, 0.83, wxT( "Green" ) );
@@ -206,9 +196,6 @@ BOARD_ADAPTER::BOARD_ADAPTER() :
g_DefaultSurfaceFinish = COLOR4D( 0.75, 0.61, 0.23, 1.0 );
g_DefaultBoardBody = COLOR4D( 0.43, 0.45, 0.30, 0.90 );
g_DefaultComments = COLOR4D( 0.85, 0.85, 0.85, 1.0 );
g_DefaultECOs = COLOR4D( 0.70, 0.10, 0.10, 1.0 );
g_ColorsLoaded = true;
}
#undef ADD_COLOR
@@ -223,51 +210,62 @@ BOARD_ADAPTER::~BOARD_ADAPTER()
void BOARD_ADAPTER::ReloadColorSettings() noexcept
{
wxCHECK( PgmOrNull(), /* void */ );
wxASSERT( PgmOrNull() );
PCBNEW_SETTINGS* cfg = nullptr;
try
{
cfg = Pgm().GetSettingsManager().GetAppSettings<PCBNEW_SETTINGS>();
}
catch( const std::runtime_error& e )
{
wxFAIL_MSG( e.what() );
}
if( cfg )
{
m_colors = Pgm().GetSettingsManager().GetColorSettings( cfg->m_ColorTheme );
}
PCBNEW_SETTINGS* settings = Pgm().GetSettingsManager().GetAppSettings<PCBNEW_SETTINGS>();
m_colors = Pgm().GetSettingsManager().GetColorSettings( settings->m_ColorTheme );
}
bool BOARD_ADAPTER::Is3dLayerEnabled( PCB_LAYER_ID aLayer,
const std::bitset<LAYER_3D_END>& aVisibilityFlags ) const
bool BOARD_ADAPTER::Is3dLayerEnabled( PCB_LAYER_ID aLayer ) const
{
wxASSERT( aLayer < PCB_LAYER_ID_COUNT );
if( m_board && !m_board->IsLayerEnabled( aLayer ) )
return false;
// see if layer needs to be shown
// check the flags
switch( aLayer )
{
case B_Cu: return aVisibilityFlags.test( LAYER_3D_COPPER_BOTTOM );
case F_Cu: return aVisibilityFlags.test( LAYER_3D_COPPER_TOP );
case B_Adhes: return aVisibilityFlags.test( LAYER_3D_ADHESIVE );
case F_Adhes: return aVisibilityFlags.test( LAYER_3D_ADHESIVE );
case B_Paste: return aVisibilityFlags.test( LAYER_3D_SOLDERPASTE );
case F_Paste: return aVisibilityFlags.test( LAYER_3D_SOLDERPASTE );
case B_SilkS: return aVisibilityFlags.test( LAYER_3D_SILKSCREEN_BOTTOM );
case F_SilkS: return aVisibilityFlags.test( LAYER_3D_SILKSCREEN_TOP );
case B_Mask: return aVisibilityFlags.test( LAYER_3D_SOLDERMASK_BOTTOM );
case F_Mask: return aVisibilityFlags.test( LAYER_3D_SOLDERMASK_TOP );
case Dwgs_User: return aVisibilityFlags.test( LAYER_3D_USER_DRAWINGS );
case Cmts_User: return aVisibilityFlags.test( LAYER_3D_USER_COMMENTS );
case Eco1_User: return aVisibilityFlags.test( LAYER_3D_USER_ECO1 );
case Eco2_User: return aVisibilityFlags.test( LAYER_3D_USER_ECO2 );
default: return m_board && m_board->IsLayerVisible( aLayer );
case B_Adhes:
case F_Adhes:
return m_Cfg->m_Render.show_adhesive;
case B_Paste:
case F_Paste:
return m_Cfg->m_Render.show_solderpaste;
case B_SilkS:
case F_SilkS:
return m_Cfg->m_Render.show_silkscreen;
case B_Mask:
case F_Mask:
return m_Cfg->m_Render.show_soldermask;
case Dwgs_User:
case Cmts_User:
return !m_Cfg->m_Render.realistic && m_Cfg->m_Render.show_comments;
case Eco1_User:
case Eco2_User:
return !m_Cfg->m_Render.realistic && m_Cfg->m_Render.show_eco;
case Edge_Cuts:
return !m_Cfg->m_Render.realistic && !m_Cfg->m_Render.show_board_body;
case Margin:
return !m_Cfg->m_Render.realistic;
case B_Cu:
case F_Cu:
return !m_board || m_board->IsLayerVisible( aLayer ) || m_Cfg->m_Render.realistic
|| m_board->IsFootprintHolder();
default:
// the layer is an internal copper layer, used the visibility
return m_board && m_board->IsLayerVisible( aLayer );
}
}
@@ -283,12 +281,6 @@ bool BOARD_ADAPTER::IsFootprintShown( FOOTPRINT_ATTR_T aFPAttributes ) const
return false;
}
if( aFPAttributes & FP_DNP )
{
if( !m_Cfg->m_Render.show_footprints_dnp )
return false;
}
if( aFPAttributes & FP_SMD )
return m_Cfg->m_Render.show_footprints_insert;
@@ -344,7 +336,11 @@ void BOARD_ADAPTER::InitSettings( REPORTER* aStatusReporter, REPORTER* aWarningR
BOX2I bbbox;
if( m_board )
bbbox = m_board->ComputeBoundingBox( !m_board->IsFootprintHolder() && haveOutline );
{
bbbox = m_board->ComputeBoundingBox( !m_board->IsFootprintHolder()
&& m_Cfg->m_Render.realistic
&& haveOutline );
}
// Gives a non null size to avoid issues in zoom / scale calculations
if( ( bbbox.GetWidth() == 0 ) && ( bbbox.GetHeight() == 0 ) )
@@ -367,10 +363,6 @@ void BOARD_ADAPTER::InitSettings( REPORTER* aStatusReporter, REPORTER* aWarningR
// Calculate the conversion to apply to all positions.
m_biuTo3Dunits = RANGE_SCALE_3D / std::max( m_boardSize.x, m_boardSize.y );
// Hack to keep "home" zoom from being too small.
if( !m_board || !m_board->IsFootprintHolder() )
m_biuTo3Dunits *= 1.6f;
m_boardBodyThickness3DU = DEFAULT_BOARD_THICKNESS * m_biuTo3Dunits;
m_frontCopperThickness3DU = DEFAULT_COPPER_THICKNESS * m_biuTo3Dunits;
m_backCopperThickness3DU = DEFAULT_COPPER_THICKNESS * m_biuTo3Dunits;
@@ -397,18 +389,13 @@ void BOARD_ADAPTER::InitSettings( REPORTER* aStatusReporter, REPORTER* aWarningR
break;
case BS_ITEM_TYPE_COPPER:
{
// The copper thickness must be > 0 to avoid draw issues (divide by 0 for instance)
// We use a minimal arbitrary value = 1 micrometer here:
int copper_thickness = std::max( item->GetThickness(), pcbIUScale.mmToIU( 0.001 ) );
if( item->GetBrdLayerId() == F_Cu )
m_frontCopperThickness3DU = copper_thickness * m_biuTo3Dunits;
m_frontCopperThickness3DU = item->GetThickness() * m_biuTo3Dunits;
else if( item->GetBrdLayerId() == B_Cu )
m_backCopperThickness3DU = copper_thickness * m_biuTo3Dunits;
m_backCopperThickness3DU = item->GetThickness() * m_biuTo3Dunits;
else if( item->IsEnabled() )
thickness += copper_thickness;
}
thickness += item->GetThickness();
break;
default:
@@ -454,7 +441,7 @@ void BOARD_ADAPTER::InitSettings( REPORTER* aStatusReporter, REPORTER* aWarningR
for( ; layer < MAX_CU_LAYERS; layer++ )
{
m_layerZcoordBottom[layer] = -( m_boardBodyThickness3DU / 2.0f );
m_layerZcoordTop[layer] = m_layerZcoordBottom[layer] - m_backCopperThickness3DU;
m_layerZcoordTop[layer] = -( m_boardBodyThickness3DU / 2.0f ) - m_backCopperThickness3DU;
}
// This is the top of the copper layer thickness.
@@ -510,6 +497,7 @@ void BOARD_ADAPTER::InitSettings( REPORTER* aStatusReporter, REPORTER* aWarningR
zposTop = zposBottom + m_nonCopperLayerThickness3DU;
break;
// !TODO: review
default:
zposTop = zpos_copperTop_front + (layer_id - MAX_CU_LAYERS + 3.0f) * zpos_offset;
zposBottom = zposTop - m_nonCopperLayerThickness3DU;
@@ -535,7 +523,7 @@ void BOARD_ADAPTER::InitSettings( REPORTER* aStatusReporter, REPORTER* aWarningR
m_boardBoundingBox = BBOX_3D( boardMin, boardMax );
#ifdef PRINT_STATISTICS_3D_VIEWER
int64_t stats_startCreateBoardPolyTime = GetRunningMicroSecs();
unsigned stats_startCreateBoardPolyTime = GetRunningMicroSecs();
#endif
if( aStatusReporter )
@@ -543,73 +531,22 @@ void BOARD_ADAPTER::InitSettings( REPORTER* aStatusReporter, REPORTER* aWarningR
createLayers( aStatusReporter );
COLOR_SETTINGS* colors = Pgm().GetSettingsManager().GetColorSettings();
auto to_SFVEC4F =
[]( const COLOR4D& src )
{
return SFVEC4F( src.r, src.g, src.b, src.a );
};
std::map<int, COLOR4D> colors = GetLayerColors();
m_BgColorTop = to_SFVEC4F( colors->GetColor( LAYER_3D_BACKGROUND_TOP ) );
m_BgColorBot = to_SFVEC4F( colors->GetColor( LAYER_3D_BACKGROUND_BOTTOM ) );
m_BgColorTop = to_SFVEC4F( colors[ LAYER_3D_BACKGROUND_TOP ] );
m_BgColorBot = to_SFVEC4F( colors[ LAYER_3D_BACKGROUND_BOTTOM ] );
m_SolderPasteColor = to_SFVEC4F( colors[ LAYER_3D_SOLDERPASTE ] );
m_SilkScreenColorBot = to_SFVEC4F( colors[ LAYER_3D_SILKSCREEN_BOTTOM ] );
m_SilkScreenColorTop = to_SFVEC4F( colors[ LAYER_3D_SILKSCREEN_TOP ] );
m_SolderMaskColorBot = to_SFVEC4F( colors[ LAYER_3D_SOLDERMASK_BOTTOM ] );
m_SolderMaskColorTop = to_SFVEC4F( colors[ LAYER_3D_SOLDERMASK_TOP ] );
m_CopperColor = to_SFVEC4F( colors[ LAYER_3D_COPPER_TOP ] );
m_BoardBodyColor = to_SFVEC4F( colors[ LAYER_3D_BOARD ] );
m_UserDrawingsColor = to_SFVEC4F( colors[ LAYER_3D_USER_DRAWINGS ] );
m_UserCommentsColor = to_SFVEC4F( colors[ LAYER_3D_USER_COMMENTS ] );
m_ECO1Color = to_SFVEC4F( colors[ LAYER_3D_USER_ECO1 ] );
m_ECO2Color = to_SFVEC4F( colors[ LAYER_3D_USER_ECO2 ] );
}
m_SolderPasteColor = to_SFVEC4F( colors->GetColor( LAYER_3D_SOLDERPASTE ) );
std::map<int, COLOR4D> BOARD_ADAPTER::GetDefaultColors() const
{
std::map<int, COLOR4D> colors;
colors[ LAYER_3D_BACKGROUND_TOP ] = BOARD_ADAPTER::g_DefaultBackgroundTop;
colors[ LAYER_3D_BACKGROUND_BOTTOM ] = BOARD_ADAPTER::g_DefaultBackgroundBot;
colors[ LAYER_3D_BOARD ] = BOARD_ADAPTER::g_DefaultBoardBody;
colors[ LAYER_3D_COPPER_TOP ] = BOARD_ADAPTER::g_DefaultSurfaceFinish;
colors[ LAYER_3D_COPPER_BOTTOM ] = BOARD_ADAPTER::g_DefaultSurfaceFinish;
colors[ LAYER_3D_SILKSCREEN_TOP ] = BOARD_ADAPTER::g_DefaultSilkscreen;
colors[ LAYER_3D_SILKSCREEN_BOTTOM ] = BOARD_ADAPTER::g_DefaultSilkscreen;
colors[ LAYER_3D_SOLDERMASK_TOP ] = BOARD_ADAPTER::g_DefaultSolderMask;
colors[ LAYER_3D_SOLDERMASK_BOTTOM ] = BOARD_ADAPTER::g_DefaultSolderMask;
colors[ LAYER_3D_SOLDERPASTE ] = BOARD_ADAPTER::g_DefaultSolderPaste;
colors[ LAYER_3D_USER_DRAWINGS ] = BOARD_ADAPTER::g_DefaultComments;
colors[ LAYER_3D_USER_COMMENTS ] = BOARD_ADAPTER::g_DefaultComments;
colors[ LAYER_3D_USER_ECO1 ] = BOARD_ADAPTER::g_DefaultECOs;
colors[ LAYER_3D_USER_ECO2 ] = BOARD_ADAPTER::g_DefaultECOs;
return colors;
}
std::map<int, COLOR4D> BOARD_ADAPTER::GetLayerColors() const
{
std::map<int, COLOR4D> colors;
if( LAYER_PRESET_3D* preset = m_Cfg->FindPreset( m_Cfg->m_CurrentPreset ) )
{
colors = preset->colors;
}
else
{
COLOR_SETTINGS* settings = Pgm().GetSettingsManager().GetColorSettings();
for( const auto& [ layer, defaultColor /* unused */ ] : GetDefaultColors() )
colors[ layer ] = settings->GetColor( layer );
}
if( m_Cfg->m_UseStackupColors && m_board )
if( m_board && colors->GetUseBoardStackupColors() )
{
const BOARD_STACKUP& stackup = m_board->GetDesignSettings().GetStackupDescriptor();
KIGFX::COLOR4D bodyColor( 0, 0, 0, 0 );
auto findColor =
[]( const wxString& aColorName, const CUSTOM_COLORS_LIST& aColorSet )
@@ -630,6 +567,13 @@ std::map<int, COLOR4D> BOARD_ADAPTER::GetLayerColors() const
return KIGFX::COLOR4D();
};
m_SilkScreenColorTop = to_SFVEC4F( g_DefaultSilkscreen );
m_SilkScreenColorBot = to_SFVEC4F( g_DefaultSilkscreen );
m_SolderMaskColorTop = to_SFVEC4F( g_DefaultSolderMask );
m_SolderMaskColorBot = to_SFVEC4F( g_DefaultSolderMask );
KIGFX::COLOR4D bodyColor( 0, 0, 0, 0 );
for( const BOARD_STACKUP_ITEM* stackupItem : stackup.GetList() )
{
wxString colorName = stackupItem->GetColor();
@@ -638,17 +582,16 @@ std::map<int, COLOR4D> BOARD_ADAPTER::GetLayerColors() const
{
case BS_ITEM_TYPE_SILKSCREEN:
if( stackupItem->GetBrdLayerId() == F_SilkS )
colors[ LAYER_3D_SILKSCREEN_TOP ] = findColor( colorName, g_SilkColors );
m_SilkScreenColorTop = to_SFVEC4F( findColor( colorName, g_SilkscreenColors ) );
else
colors[ LAYER_3D_SILKSCREEN_BOTTOM ] = findColor( colorName, g_SilkColors );
m_SilkScreenColorBot = to_SFVEC4F( findColor( colorName, g_SilkscreenColors ) );
break;
case BS_ITEM_TYPE_SOLDERMASK:
if( stackupItem->GetBrdLayerId() == F_Mask )
colors[ LAYER_3D_SOLDERMASK_TOP ] = findColor( colorName, g_MaskColors );
m_SolderMaskColorTop = to_SFVEC4F( findColor( colorName, g_MaskColors ) );
else
colors[ LAYER_3D_SOLDERMASK_BOTTOM ] = findColor( colorName, g_MaskColors );
m_SolderMaskColorBot = to_SFVEC4F( findColor( colorName, g_MaskColors ) );
break;
@@ -671,220 +614,46 @@ std::map<int, COLOR4D> BOARD_ADAPTER::GetLayerColors() const
}
if( bodyColor != COLOR4D( 0, 0, 0, 0 ) )
colors[ LAYER_3D_BOARD ] = bodyColor;
m_BoardBodyColor = to_SFVEC4F( bodyColor );
else
m_BoardBodyColor = to_SFVEC4F( g_DefaultBoardBody );
const wxString& finishName = stackup.m_FinishType;
if( finishName.EndsWith( wxT( "OSP" ) ) )
{
colors[ LAYER_3D_COPPER_TOP ] = findColor( wxT( "Copper" ), g_FinishColors );
m_CopperColor = to_SFVEC4F( findColor( wxT( "Copper" ), g_FinishColors ) );
}
else if( finishName.EndsWith( wxT( "IG" ) )
|| finishName.EndsWith( wxT( "gold" ) ) )
{
colors[ LAYER_3D_COPPER_TOP ] = findColor( wxT( "Gold" ), g_FinishColors );
m_CopperColor = to_SFVEC4F( findColor( wxT( "Gold" ), g_FinishColors ) );
}
else if( finishName.StartsWith( wxT( "HAL" ) )
|| finishName.StartsWith( wxT( "HASL" ) )
|| finishName.EndsWith( wxT( "tin" ) )
|| finishName.EndsWith( wxT( "nickel" ) ) )
{
colors[ LAYER_3D_COPPER_TOP ] = findColor( wxT( "Tin" ), g_FinishColors );
m_CopperColor = to_SFVEC4F( findColor( wxT( "Tin" ), g_FinishColors ) );
}
else if( finishName.EndsWith( wxT( "silver" ) ) )
{
colors[ LAYER_3D_COPPER_TOP ] = findColor( wxT( "Silver" ), g_FinishColors );
m_CopperColor = to_SFVEC4F( findColor( wxT( "Silver" ), g_FinishColors ) );
}
else
{
m_CopperColor = to_SFVEC4F( g_DefaultSurfaceFinish );
}
}
colors[ LAYER_3D_COPPER_BOTTOM ] = colors[ LAYER_3D_COPPER_TOP ];
return colors;
}
void BOARD_ADAPTER::SetLayerColors( const std::map<int, COLOR4D>& aColors )
{
COLOR_SETTINGS* settings = Pgm().GetSettingsManager().GetColorSettings();
for( const auto& [ layer, color ] : aColors )
settings->SetColor( layer, color );
}
void BOARD_ADAPTER::SetVisibleLayers( const std::bitset<LAYER_3D_END>& aLayers )
{
m_Cfg->m_Render.show_board_body = aLayers.test( LAYER_3D_BOARD );
m_Cfg->m_Render.show_copper_top = aLayers.test( LAYER_3D_COPPER_TOP );
m_Cfg->m_Render.show_copper_bottom = aLayers.test( LAYER_3D_COPPER_BOTTOM );
m_Cfg->m_Render.show_silkscreen_top = aLayers.test( LAYER_3D_SILKSCREEN_TOP );
m_Cfg->m_Render.show_silkscreen_bottom = aLayers.test( LAYER_3D_SILKSCREEN_BOTTOM );
m_Cfg->m_Render.show_soldermask_top = aLayers.test( LAYER_3D_SOLDERMASK_TOP );
m_Cfg->m_Render.show_soldermask_bottom = aLayers.test( LAYER_3D_SOLDERMASK_BOTTOM );
m_Cfg->m_Render.show_solderpaste = aLayers.test( LAYER_3D_SOLDERPASTE );
m_Cfg->m_Render.show_adhesive = aLayers.test( LAYER_3D_ADHESIVE );
m_Cfg->m_Render.show_comments = aLayers.test( LAYER_3D_USER_COMMENTS );
m_Cfg->m_Render.show_drawings = aLayers.test( LAYER_3D_USER_DRAWINGS );
m_Cfg->m_Render.show_eco1 = aLayers.test( LAYER_3D_USER_ECO1 );
m_Cfg->m_Render.show_eco2 = aLayers.test( LAYER_3D_USER_ECO2 );
m_Cfg->m_Render.show_footprints_normal = aLayers.test( LAYER_3D_TH_MODELS );
m_Cfg->m_Render.show_footprints_insert = aLayers.test( LAYER_3D_SMD_MODELS );
m_Cfg->m_Render.show_footprints_virtual = aLayers.test( LAYER_3D_VIRTUAL_MODELS );
m_Cfg->m_Render.show_footprints_not_in_posfile = aLayers.test( LAYER_3D_MODELS_NOT_IN_POS );
m_Cfg->m_Render.show_footprints_dnp = aLayers.test( LAYER_3D_MODELS_MARKED_DNP );
m_Cfg->m_Render.show_fp_references = aLayers.test( LAYER_FP_REFERENCES );
m_Cfg->m_Render.show_fp_values = aLayers.test( LAYER_FP_VALUES );
m_Cfg->m_Render.show_fp_text = aLayers.test( LAYER_FP_TEXT );
m_Cfg->m_Render.show_model_bbox = aLayers.test( LAYER_3D_BOUNDING_BOXES );
m_Cfg->m_Render.show_off_board_silk = aLayers.test( LAYER_3D_OFF_BOARD_SILK );
m_Cfg->m_Render.show_axis = aLayers.test( LAYER_3D_AXES );
}
std::bitset<LAYER_3D_END> BOARD_ADAPTER::GetVisibleLayers() const
{
std::bitset<LAYER_3D_END> ret;
ret.set( LAYER_3D_BOARD, m_Cfg->m_Render.show_board_body );
ret.set( LAYER_3D_COPPER_TOP, m_Cfg->m_Render.show_copper_top );
ret.set( LAYER_3D_COPPER_BOTTOM, m_Cfg->m_Render.show_copper_bottom );
ret.set( LAYER_3D_SILKSCREEN_TOP, m_Cfg->m_Render.show_silkscreen_top );
ret.set( LAYER_3D_SILKSCREEN_BOTTOM, m_Cfg->m_Render.show_silkscreen_bottom );
ret.set( LAYER_3D_SOLDERMASK_TOP, m_Cfg->m_Render.show_soldermask_top );
ret.set( LAYER_3D_SOLDERMASK_BOTTOM, m_Cfg->m_Render.show_soldermask_bottom );
ret.set( LAYER_3D_SOLDERPASTE, m_Cfg->m_Render.show_solderpaste );
ret.set( LAYER_3D_ADHESIVE, m_Cfg->m_Render.show_adhesive );
ret.set( LAYER_3D_USER_COMMENTS, m_Cfg->m_Render.show_comments );
ret.set( LAYER_3D_USER_DRAWINGS, m_Cfg->m_Render.show_drawings );
ret.set( LAYER_3D_USER_ECO1, m_Cfg->m_Render.show_eco1 );
ret.set( LAYER_3D_USER_ECO2, m_Cfg->m_Render.show_eco2 );
ret.set( LAYER_FP_REFERENCES, m_Cfg->m_Render.show_fp_references );
ret.set( LAYER_FP_VALUES, m_Cfg->m_Render.show_fp_values );
ret.set( LAYER_FP_TEXT, m_Cfg->m_Render.show_fp_text );
ret.set( LAYER_3D_TH_MODELS, m_Cfg->m_Render.show_footprints_normal );
ret.set( LAYER_3D_SMD_MODELS, m_Cfg->m_Render.show_footprints_insert );
ret.set( LAYER_3D_VIRTUAL_MODELS, m_Cfg->m_Render.show_footprints_virtual );
ret.set( LAYER_3D_MODELS_NOT_IN_POS, m_Cfg->m_Render.show_footprints_not_in_posfile );
ret.set( LAYER_3D_MODELS_MARKED_DNP, m_Cfg->m_Render.show_footprints_dnp );
ret.set( LAYER_3D_BOUNDING_BOXES, m_Cfg->m_Render.show_model_bbox );
ret.set( LAYER_3D_OFF_BOARD_SILK, m_Cfg->m_Render.show_off_board_silk );
ret.set( LAYER_3D_AXES, m_Cfg->m_Render.show_axis );
if( m_Cfg->m_CurrentPreset == FOLLOW_PCB )
{
if( !m_board )
return ret;
ret.set( LAYER_3D_BOARD, true );
ret.set( LAYER_3D_COPPER_TOP, m_board->IsLayerVisible( F_Cu ) );
ret.set( LAYER_3D_COPPER_BOTTOM, m_board->IsLayerVisible( B_Cu ) );
ret.set( LAYER_3D_SILKSCREEN_TOP, m_board->IsLayerVisible( F_SilkS ) );
ret.set( LAYER_3D_SILKSCREEN_BOTTOM, m_board->IsLayerVisible( B_SilkS ) );
ret.set( LAYER_3D_SOLDERMASK_TOP, m_board->IsLayerVisible( F_Mask ) );
ret.set( LAYER_3D_SOLDERMASK_BOTTOM, m_board->IsLayerVisible( B_Mask ) );
ret.set( LAYER_3D_SOLDERPASTE, m_board->IsLayerVisible( F_Paste ) );
ret.set( LAYER_3D_ADHESIVE, m_board->IsLayerVisible( F_Adhes ) );
ret.set( LAYER_3D_USER_COMMENTS, m_board->IsLayerVisible( Cmts_User ) );
ret.set( LAYER_3D_USER_DRAWINGS, m_board->IsLayerVisible( Dwgs_User ) );
ret.set( LAYER_3D_USER_ECO1, m_board->IsLayerVisible( Eco1_User ) );
ret.set( LAYER_3D_USER_ECO2, m_board->IsLayerVisible( Eco2_User ) );
for( GAL_LAYER_ID layer : { LAYER_FP_REFERENCES, LAYER_FP_VALUES, LAYER_FP_TEXT } )
ret.set( layer, m_board->IsElementVisible( layer ) );
}
else if( m_Cfg->m_CurrentPreset == FOLLOW_PLOT_SETTINGS )
{
if( !m_board )
return ret;
const PCB_PLOT_PARAMS& plotParams = m_board->GetPlotOptions();
LSET layers = plotParams.GetLayerSelection() | plotParams.GetPlotOnAllLayersSelection();
ret.set( LAYER_3D_BOARD, true );
ret.set( LAYER_3D_COPPER_TOP, layers.test( F_Cu ) );
ret.set( LAYER_3D_COPPER_BOTTOM, layers.test( B_Cu ) );
ret.set( LAYER_3D_SILKSCREEN_TOP, layers.test( F_SilkS ) );
ret.set( LAYER_3D_SILKSCREEN_BOTTOM, layers.test( B_SilkS ) );
ret.set( LAYER_3D_SOLDERMASK_TOP, layers.test( F_Mask ) );
ret.set( LAYER_3D_SOLDERMASK_BOTTOM, layers.test( B_Mask ) );
ret.set( LAYER_3D_SOLDERPASTE, layers.test( F_Paste ) );
ret.set( LAYER_3D_ADHESIVE, layers.test( F_Adhes ) );
ret.set( LAYER_3D_USER_COMMENTS, layers.test( Cmts_User ) );
ret.set( LAYER_3D_USER_DRAWINGS, layers.test( Dwgs_User ) );
ret.set( LAYER_3D_USER_ECO1, layers.test( Eco1_User ) );
ret.set( LAYER_3D_USER_ECO2, layers.test( Eco2_User ) );
ret.set( LAYER_FP_REFERENCES, plotParams.GetPlotReference() );
ret.set( LAYER_FP_VALUES, plotParams.GetPlotValue() );
ret.set( LAYER_FP_TEXT, plotParams.GetPlotFPText() );
}
else if( LAYER_PRESET_3D* preset = m_Cfg->FindPreset( m_Cfg->m_CurrentPreset ) )
{
ret = preset->layers;
}
else
{
ret.set( LAYER_3D_BOARD, m_Cfg->m_Render.show_board_body );
ret.set( LAYER_3D_COPPER_TOP, m_Cfg->m_Render.show_copper_top );
ret.set( LAYER_3D_COPPER_BOTTOM, m_Cfg->m_Render.show_copper_bottom );
ret.set( LAYER_3D_SILKSCREEN_TOP, m_Cfg->m_Render.show_silkscreen_top );
ret.set( LAYER_3D_SILKSCREEN_BOTTOM, m_Cfg->m_Render.show_silkscreen_bottom );
ret.set( LAYER_3D_SOLDERMASK_TOP, m_Cfg->m_Render.show_soldermask_top );
ret.set( LAYER_3D_SOLDERMASK_BOTTOM, m_Cfg->m_Render.show_soldermask_bottom );
ret.set( LAYER_3D_SOLDERPASTE, m_Cfg->m_Render.show_solderpaste );
ret.set( LAYER_3D_ADHESIVE, m_Cfg->m_Render.show_adhesive );
ret.set( LAYER_3D_USER_COMMENTS, m_Cfg->m_Render.show_comments );
ret.set( LAYER_3D_USER_DRAWINGS, m_Cfg->m_Render.show_drawings );
ret.set( LAYER_3D_USER_ECO1, m_Cfg->m_Render.show_eco1 );
ret.set( LAYER_3D_USER_ECO2, m_Cfg->m_Render.show_eco2 );
ret.set( LAYER_FP_REFERENCES, m_Cfg->m_Render.show_fp_references );
ret.set( LAYER_FP_VALUES, m_Cfg->m_Render.show_fp_values );
ret.set( LAYER_FP_TEXT, m_Cfg->m_Render.show_fp_text );
m_SilkScreenColorBot = to_SFVEC4F( colors->GetColor( LAYER_3D_SILKSCREEN_BOTTOM ) );
m_SilkScreenColorTop = to_SFVEC4F( colors->GetColor( LAYER_3D_SILKSCREEN_TOP ) );
m_SolderMaskColorBot = to_SFVEC4F( colors->GetColor( LAYER_3D_SOLDERMASK_BOTTOM ) );
m_SolderMaskColorTop = to_SFVEC4F( colors->GetColor( LAYER_3D_SOLDERMASK_TOP ) );
m_CopperColor = to_SFVEC4F( colors->GetColor( LAYER_3D_COPPER ) );
m_BoardBodyColor = to_SFVEC4F( colors->GetColor( LAYER_3D_BOARD ) );
}
return ret;
}
std::bitset<LAYER_3D_END> BOARD_ADAPTER::GetDefaultVisibleLayers() const
{
std::bitset<LAYER_3D_END> ret;
ret.set( LAYER_3D_BOARD, true );
ret.set( LAYER_3D_COPPER_TOP, true );
ret.set( LAYER_3D_COPPER_BOTTOM, true );
ret.set( LAYER_3D_SILKSCREEN_TOP, true );
ret.set( LAYER_3D_SILKSCREEN_BOTTOM, true );
ret.set( LAYER_3D_SOLDERMASK_TOP, true );
ret.set( LAYER_3D_SOLDERMASK_BOTTOM, true );
ret.set( LAYER_3D_SOLDERPASTE, true );
ret.set( LAYER_3D_ADHESIVE, true );
ret.set( LAYER_3D_USER_COMMENTS, false );
ret.set( LAYER_3D_USER_DRAWINGS, false );
ret.set( LAYER_3D_USER_ECO1, false );
ret.set( LAYER_3D_USER_ECO2, false );
ret.set( LAYER_FP_REFERENCES, true );
ret.set( LAYER_FP_VALUES, true );
ret.set( LAYER_FP_TEXT, true );
ret.set( LAYER_3D_TH_MODELS, true );
ret.set( LAYER_3D_SMD_MODELS, true );
ret.set( LAYER_3D_VIRTUAL_MODELS, true );
ret.set( LAYER_3D_MODELS_NOT_IN_POS, false );
ret.set( LAYER_3D_MODELS_MARKED_DNP, false );
ret.set( LAYER_3D_BOUNDING_BOXES, false );
ret.set( LAYER_3D_OFF_BOARD_SILK, false );
ret.set( LAYER_3D_AXES, true );
return ret;
}
@@ -925,7 +694,7 @@ bool BOARD_ADAPTER::createBoardPolygon( wxString* aErrorMsg )
}
else
{
success = m_board->GetBoardPolygonOutlines( m_board_poly, nullptr, false, true );
success = m_board->GetBoardPolygonOutlines( m_board_poly );
if( !success && aErrorMsg )
*aErrorMsg = _( "Board outline is missing or malformed. Run DRC for a full analysis." );
@@ -938,9 +707,19 @@ bool BOARD_ADAPTER::createBoardPolygon( wxString* aErrorMsg )
float BOARD_ADAPTER::GetFootprintZPos( bool aIsFlipped ) const
{
if( aIsFlipped )
return m_layerZcoordBottom[B_Paste];
{
if( m_Cfg->m_Render.show_solderpaste )
return m_layerZcoordBottom[B_SilkS];
else
return m_layerZcoordBottom[B_Paste];
}
else
return m_layerZcoordTop[F_Paste];
{
if( m_Cfg->m_Render.show_solderpaste )
return m_layerZcoordTop[F_SilkS];
else
return m_layerZcoordTop[F_Paste];
}
}
+67 -90
View File
@@ -2,8 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
* Copyright (C) 2023 CERN
* Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -31,7 +30,7 @@
#include "../3d_rendering/raytracing/accelerators/container_2d.h"
#include "../3d_rendering/raytracing/accelerators/container_3d.h"
#include "../3d_rendering/raytracing/shapes3D/bbox_3d.h"
#include <gal/3d/camera.h>
#include "../3d_rendering/camera.h"
#include "../3d_enums.h"
#include "../3d_cache/3d_cache.h"
#include "../common_ogl/ogl_attr_list.h"
@@ -50,7 +49,6 @@
#include <dialogs/dialog_color_picker.h>
class COLOR_SETTINGS;
class PCB_TEXTBOX;
/// A type that stores a container of 2d objects for each layer id
typedef std::map<PCB_LAYER_ID, BVH_CONTAINER_2D*> MAP_CONTAINER_2D_BASE;
@@ -87,8 +85,7 @@ public:
*
* @param aLayer layer ID to get status.
*/
bool Is3dLayerEnabled( PCB_LAYER_ID aLayer,
const std::bitset<LAYER_3D_END>& aVisibilityFlags ) const;
bool Is3dLayerEnabled( PCB_LAYER_ID aLayer ) const;
/**
* Test if footprint should be displayed in relation to attributes and the flags.
@@ -105,14 +102,6 @@ public:
void ReloadColorSettings() noexcept;
std::map<int, COLOR4D> GetLayerColors() const;
std::map<int, COLOR4D> GetDefaultColors() const;
void SetLayerColors( const std::map<int, COLOR4D>& aColors );
std::bitset<LAYER_3D_END> GetVisibleLayers() const;
std::bitset<LAYER_3D_END> GetDefaultVisibleLayers() const;
void SetVisibleLayers( const std::bitset<LAYER_3D_END>& aLayers );
/**
* Function to be called by the render when it need to reload the settings for the board.
*
@@ -247,12 +236,10 @@ public:
const MAP_CONTAINER_2D_BASE& GetLayerMap() const noexcept { return m_layerMap; }
const BVH_CONTAINER_2D* GetPlatedPadsFront() const noexcept { return m_platedPadsFront; }
const BVH_CONTAINER_2D* GetPlatedPadsBack() const noexcept { return m_platedPadsBack; }
const BVH_CONTAINER_2D* GetOffboardPadsFront() const noexcept { return m_offboardPadsFront; }
const BVH_CONTAINER_2D* GetOffboardPadsBack() const noexcept { return m_offboardPadsBack; }
const MAP_CONTAINER_2D_BASE& GetLayerHoleMap() const noexcept { return m_layerHoleMap; }
const BVH_CONTAINER_2D& GetTH_IDs() const noexcept { return m_TH_IDs; }
const BVH_CONTAINER_2D& GetTH_ODs() const noexcept { return m_TH_ODs; }
const BVH_CONTAINER_2D& GetThroughHoleIds() const noexcept { return m_throughHoleIds; }
const BVH_CONTAINER_2D& GetThroughHoleOds() const noexcept { return m_throughHoleOds; }
/**
* Get through hole outside diameter 2D polygons.
@@ -261,37 +248,37 @@ public:
*
* @return a container with through hold outside diameter 2D polygons.
*/
const SHAPE_POLY_SET& GetTH_ODPolys() const noexcept
const SHAPE_POLY_SET& GetThroughHoleOdPolys() const noexcept
{
return m_TH_ODPolys;
return m_throughHoleOdPolys;
}
const BVH_CONTAINER_2D& GetViaAnnuli() const noexcept
const BVH_CONTAINER_2D& GetThroughHoleAnnularRings() const noexcept
{
return m_viaAnnuli;
return m_throughHoleAnnularRings;
}
const SHAPE_POLY_SET& GetViaAnnuliPolys() const noexcept
const SHAPE_POLY_SET& GetThroughHoleAnnularRingPolys() const noexcept
{
return m_viaAnnuliPolys;
return m_throughHoleAnnularRingPolys;
}
const SHAPE_POLY_SET& GetNPTH_ODPolys() const noexcept
const SHAPE_POLY_SET& GetOuterNonPlatedThroughHolePoly() const noexcept
{
return m_NPTH_ODPolys;
return m_nonPlatedThroughHoleOdPolys;
}
/**
* @return a container with through hole via hole outside diameters.
*/
const BVH_CONTAINER_2D& GetViaTH_ODs() const noexcept
const BVH_CONTAINER_2D& GetThroughHoleViaOds() const noexcept
{
return m_viaTH_ODs;
return m_throughHoleViaOds;
}
const SHAPE_POLY_SET& GetViaTH_ODPolys() const noexcept
const SHAPE_POLY_SET& GetThroughHoleViaOdPolys() const noexcept
{
return m_viaTH_ODPolys;
return m_throughHoleViaOdPolys;
}
unsigned int GetViaCount() const noexcept { return m_viaCount; }
@@ -331,8 +318,8 @@ public:
*/
const MAP_POLY& GetPolyMap() const noexcept { return m_layers_poly; }
const SHAPE_POLY_SET* GetFrontPlatedPadAndGraphicPolys() { return m_frontPlatedPadAndGraphicPolys; }
const SHAPE_POLY_SET* GetBackPlatedPadAndGraphicPolys() { return m_backPlatedPadAndGraphicPolys; }
const SHAPE_POLY_SET* GetFrontPlatedPadPolys() { return m_frontPlatedPadPolys; }
const SHAPE_POLY_SET* GetBackPlatedPadPolys() { return m_backPlatedPadPolys; }
const MAP_POLY& GetHoleIdPolysMap() const noexcept { return m_layerHoleIdPolys; }
const MAP_POLY& GetHoleOdPolysMap() const noexcept { return m_layerHoleOdPolys; }
@@ -347,26 +334,21 @@ private:
void destroyLayers();
// Helper functions to create the board
void createViaWithMargin( const PCB_TRACK* aTrack, CONTAINER_2D_BASE* aDstContainer,
int aMargin );
void createTrack( const PCB_TRACK* aTrack, CONTAINER_2D_BASE* aDstContainer );
void createPadWithMargin( const PAD *aPad, CONTAINER_2D_BASE* aDstContainer,
PCB_LAYER_ID aLayer, const VECTOR2I& aMargin ) const;
void createPadWithHole( const PAD* aPad, CONTAINER_2D_BASE* aDstContainer,
int aInflateValue );
OBJECT_2D* createPadWithDrill( const PAD* aPad, int aInflateValue );
void addPads( const FOOTPRINT* aFootprint, CONTAINER_2D_BASE* aDstContainer,
PCB_LAYER_ID aLayerId, bool aSkipPlatedPads, bool aSkipNonPlatedPads );
void addFootprintShapes( const FOOTPRINT* aFootprint, CONTAINER_2D_BASE* aDstContainer,
PCB_LAYER_ID aLayerId,
const std::bitset<LAYER_3D_END>& aVisibilityFlags );
PCB_LAYER_ID aLayerId );
void addText( const EDA_TEXT* aText, CONTAINER_2D_BASE* aDstContainer,
const BOARD_ITEM* aOwner );
const BOARD_ITEM* aItem );
void addShape( const PCB_SHAPE* aShape, CONTAINER_2D_BASE* aContainer,
const BOARD_ITEM* aOwner );
@@ -374,20 +356,23 @@ private:
void addShape( const PCB_DIMENSION_BASE* aDimension, CONTAINER_2D_BASE* aDstContainer,
const BOARD_ITEM* aOwner );
void addShape( const PCB_TEXTBOX* aTextBox, CONTAINER_2D_BASE* aContainer,
const BOARD_ITEM* aOwner );
void addSolidAreasShapes( const ZONE* aZone, CONTAINER_2D_BASE* aDstContainer,
PCB_LAYER_ID aLayerId );
void createArcSegments( const VECTOR2I& aCentre, const VECTOR2I& aStart,
void transformArcToSegments( const VECTOR2I& aCentre, const VECTOR2I& aStart,
const EDA_ANGLE& aArcAngle, int aCircleToSegmentsCount, int aWidth,
CONTAINER_2D_BASE* aContainer, const BOARD_ITEM& aOwner );
CONTAINER_2D_BASE* aDstContainer, const BOARD_ITEM& aOwner );
void buildPadOutlineAsSegments( const PAD* aPad, CONTAINER_2D_BASE* aDstContainer, int aWidth );
// Helper functions to create poly contours
void buildPadOutlineAsPolygon( const PAD* aPad, SHAPE_POLY_SET& aBuffer, int aWidth) const;
void transformFPShapesToPolySet( const FOOTPRINT* aFootprint, PCB_LAYER_ID aLayer,
SHAPE_POLY_SET& aBuffer ) const;
public:
static CUSTOM_COLORS_LIST g_SilkColors;
static CUSTOM_COLORS_LIST g_SilkscreenColors;
static CUSTOM_COLORS_LIST g_MaskColors;
static CUSTOM_COLORS_LIST g_PasteColors;
static CUSTOM_COLORS_LIST g_FinishColors;
@@ -400,76 +385,68 @@ public:
static KIGFX::COLOR4D g_DefaultSolderPaste;
static KIGFX::COLOR4D g_DefaultSurfaceFinish;
static KIGFX::COLOR4D g_DefaultBoardBody;
static KIGFX::COLOR4D g_DefaultComments;
static KIGFX::COLOR4D g_DefaultECOs;
public:
EDA_3D_VIEWER_SETTINGS* m_Cfg;
bool m_IsBoardView;
bool m_MousewheelPanning;
bool m_IsPreviewer; ///< true if we're in a 3D preview panel, false
///< for the standard 3D viewer
bool m_IsPreviewer; ///< true if the board adaptater is living in a 3D
///< preview panel, false for the standard 3D viewer
SFVEC4F m_BgColorBot; ///< background bottom color
SFVEC4F m_BgColorTop; ///< background top color
SFVEC4F m_BoardBodyColor; ///< in realistic mode: FR4 board color
SFVEC4F m_SolderMaskColorBot; ///< in realistic mode: solder mask color ( bot )
SFVEC4F m_SolderMaskColorTop; ///< in realistic mode: solder mask color ( top )
SFVEC4F m_SolderPasteColor; ///< in realistic mode: solder paste color
SFVEC4F m_SilkScreenColorBot; ///< in realistic mode: SilkScreen color ( bot )
SFVEC4F m_SilkScreenColorTop; ///< in realistic mode: SilkScreen color ( top )
SFVEC4F m_CopperColor; ///< in realistic mode: copper color
SFVEC4F m_UserDrawingsColor;
SFVEC4F m_UserCommentsColor;
SFVEC4F m_ECO1Color;
SFVEC4F m_ECO2Color;
SFVEC4F m_BgColorBot; ///< background bottom color
SFVEC4F m_BgColorTop; ///< background top color
SFVEC4F m_BoardBodyColor; ///< in realistic mode: FR4 board color
SFVEC4F m_SolderMaskColorBot; ///< in realistic mode: solder mask color ( bot )
SFVEC4F m_SolderMaskColorTop; ///< in realistic mode: solder mask color ( top )
SFVEC4F m_SolderPasteColor; ///< in realistic mode: solder paste color
SFVEC4F m_SilkScreenColorBot; ///< in realistic mode: SilkScreen color ( bot )
SFVEC4F m_SilkScreenColorTop; ///< in realistic mode: SilkScreen color ( top )
SFVEC4F m_CopperColor; ///< in realistic mode: copper color
private:
BOARD* m_board;
S3D_CACHE* m_3dModelManager;
RENDER_SETTINGS* m_renderSettings;
COLOR_SETTINGS* m_colors;
VECTOR2I m_boardPos; ///< Board center position in board internal units.
VECTOR2I m_boardSize; ///< Board size in board internal units.
SFVEC3F m_boardCenter; ///< 3D center position of the board in 3D units.
BBOX_3D m_boardBoundingBox; ///< 3D bounding box of the board in 3D units.
VECTOR2I m_boardPos; ///< Board center position in board internal units.
VECTOR2I m_boardSize; ///< Board size in board internal units.
SFVEC3F m_boardCenter; ///< 3D center position of the board in 3D units.
BBOX_3D m_boardBoundingBox; ///< 3D bounding box of the board in 3D units.
MAP_POLY m_layers_poly; ///< Amalgamated polygon contours for various types
///< of items
MAP_POLY m_layers_poly; ///< Amalgamated polygon contours for various types of
///< items
SHAPE_POLY_SET* m_frontPlatedPadAndGraphicPolys;
SHAPE_POLY_SET* m_backPlatedPadAndGraphicPolys;
SHAPE_POLY_SET* m_frontPlatedCopperPolys;
SHAPE_POLY_SET* m_backPlatedCopperPolys;
SHAPE_POLY_SET* m_frontPlatedPadPolys;
SHAPE_POLY_SET* m_backPlatedPadPolys;
MAP_POLY m_layerHoleOdPolys; ///< Hole outer diameters (per layer)
MAP_POLY m_layerHoleIdPolys; ///< Hole inner diameters (per layer)
MAP_POLY m_layerHoleOdPolys; ///< Hole outer diameters (per layer)
MAP_POLY m_layerHoleIdPolys; ///< Hole inner diameters (per layer)
SHAPE_POLY_SET m_NPTH_ODPolys; ///< NPTH outer diameters
SHAPE_POLY_SET m_TH_ODPolys; ///< PTH outer diameters
SHAPE_POLY_SET m_viaTH_ODPolys; ///< Via hole outer diameters
SHAPE_POLY_SET m_viaAnnuliPolys; ///< Via annular ring outer diameters
SHAPE_POLY_SET m_nonPlatedThroughHoleOdPolys; ///< NPTH outer diameters
SHAPE_POLY_SET m_throughHoleOdPolys; ///< PTH outer diameters
SHAPE_POLY_SET m_throughHoleViaOdPolys; ///< Via hole outer diameters
SHAPE_POLY_SET m_throughHoleAnnularRingPolys; ///< Via annular ring outer diameters
SHAPE_POLY_SET m_board_poly; ///< Board outline polygon.
SHAPE_POLY_SET m_board_poly; ///< Board outline polygon.
MAP_CONTAINER_2D_BASE m_layerMap; ///< 2D elements for each layer.
MAP_CONTAINER_2D_BASE m_layerHoleMap; ///< Holes for each layer.
MAP_CONTAINER_2D_BASE m_layerMap; ///< 2D elements for each layer.
MAP_CONTAINER_2D_BASE m_layerHoleMap; ///< Holes for each layer.
BVH_CONTAINER_2D* m_platedPadsFront;
BVH_CONTAINER_2D* m_platedPadsBack;
BVH_CONTAINER_2D* m_offboardPadsFront;
BVH_CONTAINER_2D* m_offboardPadsBack;
BVH_CONTAINER_2D m_TH_ODs; ///< List of PTH outer diameters
BVH_CONTAINER_2D m_TH_IDs; ///< List of PTH inner diameters
BVH_CONTAINER_2D m_viaAnnuli; ///< List of via annular rings
BVH_CONTAINER_2D m_viaTH_ODs; ///< List of via hole outer diameters
BVH_CONTAINER_2D m_throughHoleOds; ///< List of PTH outer diameters
BVH_CONTAINER_2D m_throughHoleIds; ///< List of PTH inner diameters
BVH_CONTAINER_2D m_throughHoleAnnularRings; ///< List of via annular rings
BVH_CONTAINER_2D m_throughHoleViaOds; ///< List of via hole outer diameters
BVH_CONTAINER_2D m_throughHoleViaIds; ///< List of via hole inner diameters
unsigned int m_copperLayersCount;
double m_biuTo3Dunits; ///< Scale factor to convert board internal units
///< to 3D units normalized between -1.0 and 1.0.
double m_biuTo3Dunits; ///< Scale factor to convert board internal units to
///< 3D units normalized between -1.0 and 1.0.
std::array<float, PCB_LAYER_ID_COUNT> m_layerZcoordTop; ///< Top (End) Z position of each
///< layer in 3D units.
+255 -215
View File
@@ -2,8 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
* Copyright (C) 2023 CERN
* Copyright (C) 1992-2024 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -24,23 +23,27 @@
*/
/**
* @file create_3Dgraphic_brd_items.cpp
* @file create_graphic_brd_items.cpp
* @brief This file implements the creation of 2D graphic primitives of pcb items:
* pads, tracks, drawsegments, texts....
* It is based on the function found in the files:
* board_items_to_polygon_shape_transform.cpp
*/
#include "../3d_rendering/raytracing/shapes2D/ring_2d.h"
#include "../3d_rendering/raytracing/shapes2D/filled_circle_2d.h"
#include "../3d_rendering/raytracing/shapes2D/round_segment_2d.h"
#include "../3d_rendering/raytracing/shapes2D/triangle_2d.h"
#include "fp_textbox.h"
#include <board_adapter.h>
#include <footprint.h>
#include <pad.h>
#include <pcb_text.h>
#include <pcb_textbox.h>
#include <fp_shape.h>
#include <board_design_settings.h>
#include <pcb_painter.h> // for PCB_RENDER_SETTINGS
#include <zone.h>
#include <fp_text.h>
#include <convert_basic_shapes_to_polygon.h>
#include <trigo.h>
#include <geometry/shape_segment.h>
@@ -60,39 +63,8 @@
#define TO_SFVEC2F( vec ) SFVEC2F( TO_3DU( vec.x ), TO_3DU( -vec.y ) )
void addFILLED_CIRCLE_2D( CONTAINER_2D_BASE* aContainer, const SFVEC2F& aCenter, float aRadius,
const BOARD_ITEM& aBoardItem )
{
if( aRadius > 0.0f )
aContainer->Add( new FILLED_CIRCLE_2D( aCenter, aRadius, aBoardItem ) );
}
void addRING_2D( CONTAINER_2D_BASE* aContainer, const SFVEC2F& aCenter, float aInnerRadius,
float aOuterRadius, const BOARD_ITEM& aBoardItem )
{
if( aOuterRadius > aInnerRadius && aInnerRadius > 0.0f )
aContainer->Add( new RING_2D( aCenter, aInnerRadius, aOuterRadius, aBoardItem ) );
}
void addROUND_SEGMENT_2D( CONTAINER_2D_BASE* aContainer, const SFVEC2F& aStart, const SFVEC2F& aEnd,
float aWidth, const BOARD_ITEM& aBoardItem )
{
if( Is_segment_a_circle( aStart, aEnd ) )
{
// Cannot add segments that have the same start and end point
addFILLED_CIRCLE_2D( aContainer, aStart, aWidth / 2, aBoardItem );
return;
}
if( aWidth > 0.0f )
aContainer->Add( new ROUND_SEGMENT_2D( aStart, aEnd, aWidth, aBoardItem ) );
}
void BOARD_ADAPTER::addText( const EDA_TEXT* aText, CONTAINER_2D_BASE* aContainer,
const BOARD_ITEM* aOwner )
const BOARD_ITEM* aItem )
{
KIGFX::GAL_DISPLAY_OPTIONS empty_opts;
TEXT_ATTRIBUTES attrs = aText->GetAttributes();
@@ -102,17 +74,25 @@ void BOARD_ADAPTER::addText( const EDA_TEXT* aText, CONTAINER_2D_BASE* aContaine
if( !font )
font = KIFONT::FONT::GetFont( wxEmptyString, aText->IsBold(), aText->IsItalic() );
if( aOwner && aOwner->IsKnockout() )
if( aItem && aItem->IsKnockout() )
{
SHAPE_POLY_SET finalPoly;
const PCB_TEXT* pcbText = static_cast<const PCB_TEXT*>( aOwner );
int maxError = m_board->GetDesignSettings().m_MaxError;
SHAPE_POLY_SET finalPoly;
pcbText->TransformTextToPolySet( finalPoly, 0, m_board->GetDesignSettings().m_MaxError,
ERROR_INSIDE );
if( aItem->Type() == PCB_FP_TEXT_T )
{
static_cast<const FP_TEXT*>( aItem )->TransformTextToPolySet( finalPoly, 0, maxError,
ERROR_INSIDE );
}
else if( aItem->Type() == PCB_TEXT_T )
{
static_cast<const PCB_TEXT*>( aItem )->TransformTextToPolySet( finalPoly, 0, maxError,
ERROR_INSIDE );
}
// Do not call finalPoly.Fracture() here: ConvertPolygonToTriangles() call it
// if needed, and Fracture() called twice can create bad results and is useless
ConvertPolygonToTriangles( finalPoly, *aContainer, m_biuTo3Dunits, *aOwner );
ConvertPolygonToTriangles( finalPoly, *aContainer, m_biuTo3Dunits, *aItem );
}
else
{
@@ -120,20 +100,35 @@ void BOARD_ADAPTER::addText( const EDA_TEXT* aText, CONTAINER_2D_BASE* aContaine
// Stroke callback
[&]( const VECTOR2I& aPt1, const VECTOR2I& aPt2 )
{
addROUND_SEGMENT_2D( aContainer, TO_SFVEC2F( aPt1 ), TO_SFVEC2F( aPt2 ),
penWidth_3DU, *aOwner );
const SFVEC2F pt1_3DU = TO_SFVEC2F( aPt1 );
const SFVEC2F pt2_3DU = TO_SFVEC2F( aPt2 );
if( penWidth_3DU == 0.0 )
{
// Don't attempt to render degenerate shapes
}
else if( Is_segment_a_circle( pt1_3DU, pt2_3DU ) )
{
// Cannot add segments that have the same start and end point
aContainer->Add( new FILLED_CIRCLE_2D( pt1_3DU, penWidth_3DU / 2,
*aItem ) );
}
else
{
aContainer->Add( new ROUND_SEGMENT_2D( pt1_3DU, pt2_3DU, penWidth_3DU,
*aItem ) );
}
},
// Triangulation callback
[&]( const VECTOR2I& aPt1, const VECTOR2I& aPt2, const VECTOR2I& aPt3 )
{
aContainer->Add( new TRIANGLE_2D( TO_SFVEC2F( aPt1 ), TO_SFVEC2F( aPt2 ),
TO_SFVEC2F( aPt3 ), *aOwner ) );
TO_SFVEC2F( aPt3 ), *aItem ) );
} );
attrs.m_Angle = aText->GetDrawRotation();
font->Draw( &callback_gal, aText->GetShownText( true ), aText->GetDrawPos(), attrs,
aOwner->GetFontMetrics() );
font->Draw( &callback_gal, aText->GetShownText( true ), aText->GetDrawPos(), attrs );
}
}
@@ -153,19 +148,18 @@ void BOARD_ADAPTER::addShape( const PCB_DIMENSION_BASE* aDimension, CONTAINER_2D
{
const SEG& seg = static_cast<const SHAPE_SEGMENT*>( shape.get() )->GetSeg();
addROUND_SEGMENT_2D( aContainer, TO_SFVEC2F( seg.A ), TO_SFVEC2F( seg.B ),
TO_3DU( linewidth ), *aOwner );
aContainer->Add( new ROUND_SEGMENT_2D( TO_SFVEC2F( seg.A ), TO_SFVEC2F( seg.B ),
TO_3DU( linewidth ), *aOwner ) );
break;
}
case SH_CIRCLE:
{
int radius = static_cast<const SHAPE_CIRCLE*>( shape.get() )->GetRadius();
float innerR3DU = TO_3DU( radius ) - TO_3DU( aDimension->GetLineThickness() ) / 2.0f;
float outerR3DU = TO_3DU( radius ) + TO_3DU( aDimension->GetLineThickness() ) / 2.0f;
addRING_2D( aContainer, TO_SFVEC2F( shape->Centre() ), innerR3DU, outerR3DU, *aOwner );
int delta = aDimension->GetLineThickness() / 2;
aContainer->Add( new RING_2D( TO_SFVEC2F( shape->Centre() ), TO_3DU( radius - delta ),
TO_3DU( radius + delta ), *aOwner ) );
break;
}
@@ -177,69 +171,49 @@ void BOARD_ADAPTER::addShape( const PCB_DIMENSION_BASE* aDimension, CONTAINER_2D
void BOARD_ADAPTER::addFootprintShapes( const FOOTPRINT* aFootprint, CONTAINER_2D_BASE* aContainer,
PCB_LAYER_ID aLayerId,
const std::bitset<LAYER_3D_END>& aVisibilityFlags )
PCB_LAYER_ID aLayerId )
{
KIGFX::GAL_DISPLAY_OPTIONS empty_opts;
for( PCB_FIELD* field : aFootprint->GetFields() )
{
if( field->GetLayer() == aLayerId && field->IsVisible() )
{
if( !aVisibilityFlags.test( LAYER_FP_TEXT ) )
continue;
else if( field->IsReference() && !aVisibilityFlags.test( LAYER_FP_REFERENCES ) )
continue;
else if( field->IsValue() && !aVisibilityFlags.test( LAYER_FP_VALUES ) )
continue;
if( aFootprint->Reference().GetLayer() == aLayerId && aFootprint->Reference().IsVisible() )
addText( &aFootprint->Reference(), aContainer, &aFootprint->Reference() );
addText( field, aContainer, field );
}
}
if( aFootprint->Value().GetLayer() == aLayerId && aFootprint->Value().IsVisible() )
addText( &aFootprint->Value(), aContainer, &aFootprint->Value() );
for( BOARD_ITEM* item : aFootprint->GraphicalItems() )
{
switch( item->Type() )
{
case PCB_TEXT_T:
case PCB_FP_TEXT_T:
{
PCB_TEXT* text = static_cast<PCB_TEXT*>( item );
FP_TEXT* text = static_cast<FP_TEXT*>( item );
if( text->GetLayer() == aLayerId && text->IsVisible() )
{
if( !aVisibilityFlags.test( LAYER_FP_TEXT ) )
continue;
else if( text->GetText() == wxT( "${REFERENCE}" ) && !aVisibilityFlags.test( LAYER_FP_REFERENCES ) )
continue;
else if( text->GetText() == wxT( "${VALUE}" ) && !aVisibilityFlags.test( LAYER_FP_VALUES ) )
continue;
addText( text, aContainer, text );
}
break;
}
case PCB_TEXTBOX_T:
case PCB_FP_TEXTBOX_T:
{
PCB_TEXTBOX* textbox = static_cast<PCB_TEXTBOX*>( item );
FP_TEXTBOX* textbox = static_cast<FP_TEXTBOX*>( item );
if( textbox->GetLayer() == aLayerId )
{
if( textbox->IsBorderEnabled() )
addShape( textbox, aContainer, aFootprint );
addText( textbox, aContainer, aFootprint );
}
break;
}
case PCB_DIM_ALIGNED_T:
case PCB_DIM_CENTER_T:
case PCB_DIM_ORTHOGONAL_T:
case PCB_DIM_RADIAL_T:
case PCB_DIM_LEADER_T:
case PCB_FP_DIM_ALIGNED_T:
case PCB_FP_DIM_CENTER_T:
case PCB_FP_DIM_ORTHOGONAL_T:
case PCB_FP_DIM_RADIAL_T:
case PCB_FP_DIM_LEADER_T:
{
PCB_DIMENSION_BASE* dimension = static_cast<PCB_DIMENSION_BASE*>( item );
@@ -249,9 +223,9 @@ void BOARD_ADAPTER::addFootprintShapes( const FOOTPRINT* aFootprint, CONTAINER_2
break;
}
case PCB_SHAPE_T:
case PCB_FP_SHAPE_T:
{
PCB_SHAPE* shape = static_cast<PCB_SHAPE*>( item );
FP_SHAPE* shape = static_cast<FP_SHAPE*>( item );
if( shape->GetLayer() == aLayerId )
addShape( shape, aContainer, aFootprint );
@@ -266,17 +240,6 @@ void BOARD_ADAPTER::addFootprintShapes( const FOOTPRINT* aFootprint, CONTAINER_2
}
void BOARD_ADAPTER::createViaWithMargin( const PCB_TRACK* aTrack, CONTAINER_2D_BASE* aDstContainer,
int aMargin )
{
SFVEC2F start3DU = TO_SFVEC2F( aTrack->GetStart() );
SFVEC2F end3DU = TO_SFVEC2F( aTrack->GetEnd() );
const float radius3DU = TO_3DU( ( aTrack->GetWidth() / 2.0 ) + aMargin );
addFILLED_CIRCLE_2D( aDstContainer, start3DU, radius3DU, *aTrack );
}
void BOARD_ADAPTER::createTrack( const PCB_TRACK* aTrack, CONTAINER_2D_BASE* aDstContainer )
{
SFVEC2F start3DU = TO_SFVEC2F( aTrack->GetStart() );
@@ -285,8 +248,14 @@ void BOARD_ADAPTER::createTrack( const PCB_TRACK* aTrack, CONTAINER_2D_BASE* aDs
switch( aTrack->Type() )
{
case PCB_VIA_T:
addFILLED_CIRCLE_2D( aDstContainer, start3DU, TO_3DU( aTrack->GetWidth() / 2.0 ), *aTrack );
{
const float radius3DU = TO_3DU( aTrack->GetWidth() / 2 );
if( radius3DU > 0.0 )
aDstContainer->Add( new FILLED_CIRCLE_2D( start3DU, radius3DU, *aTrack ) );
break;
}
case PCB_ARC_T:
{
@@ -305,10 +274,10 @@ void BOARD_ADAPTER::createTrack( const PCB_TRACK* aTrack, CONTAINER_2D_BASE* aDs
return;
}
VECTOR2I center( arc->GetCenter() );
VECTOR2D center( arc->GetCenter() );
EDA_ANGLE arc_angle = arc->GetAngle();
double radius = arc->GetRadius();
int arcsegcount = GetArcToSegmentCount( KiROUND( radius ), ARC_HIGH_DEF, arc_angle );
int arcsegcount = GetArcToSegmentCount( radius, ARC_HIGH_DEF, arc_angle );
int circlesegcount;
// Avoid arcs that cannot be drawn
@@ -324,17 +293,32 @@ void BOARD_ADAPTER::createTrack( const PCB_TRACK* aTrack, CONTAINER_2D_BASE* aDs
else
{
circlesegcount = KiROUND( arcsegcount * 360.0 / std::abs( arc_angle.AsDegrees() ) );
circlesegcount = alg::clamp( 1, circlesegcount, 128 );
circlesegcount = std::max( 1, std::min( circlesegcount, 128 ) );
}
createArcSegments( center, arc->GetStart(), arc_angle, circlesegcount, arc->GetWidth(),
aDstContainer, *arc );
transformArcToSegments( VECTOR2I( center.x, center.y ), arc->GetStart(), arc_angle,
circlesegcount, arc->GetWidth(), aDstContainer, *arc );
break;
}
case PCB_TRACE_T: // Track is a usual straight segment
{
addROUND_SEGMENT_2D( aDstContainer, start3DU, end3DU, TO_3DU( aTrack->GetWidth() ), *aTrack );
if( aTrack->GetWidth() == 0 )
{
// Don't attempt to render degenerate shapes
}
else if( Is_segment_a_circle( start3DU, end3DU ) )
{
// Cannot add segments that have the same start and end point
aDstContainer->Add( new FILLED_CIRCLE_2D( start3DU, TO_3DU( aTrack->GetWidth() / 2 ),
*aTrack ) );
}
else
{
aDstContainer->Add( new ROUND_SEGMENT_2D( start3DU, end3DU, TO_3DU( aTrack->GetWidth() ),
*aTrack ) );
}
break;
}
@@ -367,12 +351,9 @@ void BOARD_ADAPTER::createPadWithMargin( const PAD* aPad, CONTAINER_2D_BASE* aCo
return;
PAD dummy( *aPad );
dummy.SetSize( VECTOR2I( dummySize.x, dummySize.y ) );
dummy.SetSize( wxSize( dummySize.x, dummySize.y ) );
dummy.TransformShapeToPolygon( poly, aLayer, 0, maxError, ERROR_INSIDE );
clearance = { 0, 0 };
// Remove group membership from dummy item before deleting
dummy.SetParentGroup( nullptr );
}
else
{
@@ -386,11 +367,24 @@ void BOARD_ADAPTER::createPadWithMargin( const PAD* aPad, CONTAINER_2D_BASE* aCo
{
const SHAPE_SEGMENT* seg = static_cast<const SHAPE_SEGMENT*>( shape );
addROUND_SEGMENT_2D( aContainer,
TO_SFVEC2F( seg->GetSeg().A ),
TO_SFVEC2F( seg->GetSeg().B ),
TO_3DU( seg->GetWidth() + clearance.x * 2 ),
*aPad );
const SFVEC2F a3DU = TO_SFVEC2F( seg->GetSeg().A );
const SFVEC2F b3DU = TO_SFVEC2F( seg->GetSeg().B );
const double width3DU = TO_3DU( seg->GetWidth() + clearance.x * 2 );
if( width3DU == 0.0 )
{
// Don't attempt to render degenerate shapes
}
else if( Is_segment_a_circle( a3DU, b3DU ) )
{
// Cannot add segments that have the same start and end point
aContainer->Add( new FILLED_CIRCLE_2D( a3DU, width3DU / 2, *aPad ) );
}
else
{
aContainer->Add( new ROUND_SEGMENT_2D( a3DU, b3DU, width3DU, *aPad ) );
}
break;
}
@@ -398,10 +392,13 @@ void BOARD_ADAPTER::createPadWithMargin( const PAD* aPad, CONTAINER_2D_BASE* aCo
{
const SHAPE_CIRCLE* circle = static_cast<const SHAPE_CIRCLE*>( shape );
addFILLED_CIRCLE_2D( aContainer,
TO_SFVEC2F( circle->GetCenter() ),
TO_3DU( circle->GetRadius() + clearance.x ),
*aPad );
const double radius3DU = TO_3DU( circle->GetRadius() + clearance.x );
const SFVEC2F center3DU = TO_SFVEC2F( circle->GetCenter() );
// Don't render zero radius circles
if( radius3DU > 0.0 )
aContainer->Add( new FILLED_CIRCLE_2D( center3DU, radius3DU, *aPad ) );
break;
}
@@ -433,12 +430,23 @@ void BOARD_ADAPTER::createPadWithMargin( const PAD* aPad, CONTAINER_2D_BASE* aCo
for( int i = 0; i < l.SegmentCount(); i++ )
{
SHAPE_SEGMENT seg( l.Segment( i ).A, l.Segment( i ).B, arc->GetWidth() );
const SFVEC2F a3DU = TO_SFVEC2F( seg.GetSeg().A );
const SFVEC2F b3DU = TO_SFVEC2F( seg.GetSeg().B );
const double width3DU = TO_3DU( arc->GetWidth() + clearance.x * 2 );
addROUND_SEGMENT_2D( aContainer,
TO_SFVEC2F( seg.GetSeg().A ),
TO_SFVEC2F( seg.GetSeg().B ),
TO_3DU( arc->GetWidth() + clearance.x * 2 ),
*aPad );
if( width3DU == 0.0 )
{
// Don't attempt to render degenerate shapes
}
else if( Is_segment_a_circle( a3DU, b3DU ) )
{
// Cannot add segments that have the same start and end point
aContainer->Add( new FILLED_CIRCLE_2D( a3DU, width3DU / 2, *aPad ) );
}
else
{
aContainer->Add( new ROUND_SEGMENT_2D( a3DU, b3DU, width3DU, *aPad ) );
}
}
break;
@@ -454,7 +462,7 @@ void BOARD_ADAPTER::createPadWithMargin( const PAD* aPad, CONTAINER_2D_BASE* aCo
if( !poly.IsEmpty() )
{
if( clearance.x )
poly.Inflate( clearance.x, CORNER_STRATEGY::ROUND_ALL_CORNERS, maxError );
poly.Inflate( clearance.x, 32 );
// Add the PAD polygon
ConvertPolygonToTriangles( poly, *aContainer, m_biuTo3Dunits, *aPad );
@@ -462,22 +470,29 @@ void BOARD_ADAPTER::createPadWithMargin( const PAD* aPad, CONTAINER_2D_BASE* aCo
}
void BOARD_ADAPTER::createPadWithHole( const PAD* aPad, CONTAINER_2D_BASE* aDstContainer,
int aInflateValue )
OBJECT_2D* BOARD_ADAPTER::createPadWithDrill( const PAD* aPad, int aInflateValue )
{
if( !aPad->HasHole() )
{
wxLogTrace( m_logTrace, wxT( "BOARD_ADAPTER::createPadWithHole - found an invalid pad" ) );
return;
wxLogTrace( m_logTrace, wxT( "BOARD_ADAPTER::createPadWithDrill - found an invalid pad" ) );
return nullptr;
}
std::shared_ptr<SHAPE_SEGMENT> slot = aPad->GetEffectiveHoleShape();
addROUND_SEGMENT_2D( aDstContainer,
TO_SFVEC2F( slot->GetSeg().A ),
TO_SFVEC2F( slot->GetSeg().B ),
TO_3DU( slot->GetWidth() + aInflateValue * 2 ),
*aPad );
if( slot->GetSeg().A == slot->GetSeg().B )
{
return new FILLED_CIRCLE_2D( TO_SFVEC2F( slot->GetSeg().A ),
TO_3DU( slot->GetWidth() / 2 + aInflateValue ),
*aPad );
}
else
{
return new ROUND_SEGMENT_2D( TO_SFVEC2F( slot->GetSeg().A ),
TO_SFVEC2F( slot->GetSeg().B ),
TO_3DU( slot->GetWidth() + aInflateValue * 2 ),
*aPad );
}
}
@@ -546,10 +561,10 @@ void BOARD_ADAPTER::addPads( const FOOTPRINT* aFootprint, CONTAINER_2D_BASE* aCo
// based on TransformArcToPolygon function from
// common/convert_basic_shapes_to_polygon.cpp
void BOARD_ADAPTER::createArcSegments( const VECTOR2I& aCentre, const VECTOR2I& aStart,
const EDA_ANGLE& aArcAngle, int aCircleToSegmentsCount,
int aWidth, CONTAINER_2D_BASE* aContainer,
const BOARD_ITEM& aOwner )
void BOARD_ADAPTER::transformArcToSegments( const VECTOR2I& aCentre, const VECTOR2I& aStart,
const EDA_ANGLE& aArcAngle, int aCircleToSegmentsCount,
int aWidth, CONTAINER_2D_BASE* aContainer,
const BOARD_ITEM& aOwner )
{
// Don't attempt to render degenerate shapes
if( aWidth == 0 )
@@ -579,16 +594,26 @@ void BOARD_ADAPTER::createArcSegments( const VECTOR2I& aCentre, const VECTOR2I&
curr_end = arc_start;
RotatePoint( curr_end, aCentre, -ii );
addROUND_SEGMENT_2D( aContainer, TO_SFVEC2F( curr_start ), TO_SFVEC2F( curr_end ),
TO_3DU( aWidth ), aOwner );
const SFVEC2F start3DU = TO_SFVEC2F( curr_start );
const SFVEC2F end3DU = TO_SFVEC2F( curr_end );
if( Is_segment_a_circle( start3DU, end3DU ) )
aContainer->Add( new FILLED_CIRCLE_2D( start3DU, TO_3DU( aWidth / 2 ), aOwner ) );
else
aContainer->Add( new ROUND_SEGMENT_2D( start3DU, end3DU, TO_3DU( aWidth ), aOwner ) );
curr_start = curr_end;
}
if( curr_end != arc_end )
{
addROUND_SEGMENT_2D( aContainer, TO_SFVEC2F( curr_end ), TO_SFVEC2F( arc_end ),
TO_3DU( aWidth ), aOwner );
const SFVEC2F start3DU = TO_SFVEC2F( curr_end );
const SFVEC2F end3DU = TO_SFVEC2F( arc_end );
if( Is_segment_a_circle( start3DU, end3DU ) )
aContainer->Add( new FILLED_CIRCLE_2D( start3DU, TO_3DU( aWidth / 2 ), aOwner ) );
else
aContainer->Add( new ROUND_SEGMENT_2D( start3DU, end3DU, TO_3DU( aWidth ), aOwner ) );
}
}
@@ -597,28 +622,38 @@ void BOARD_ADAPTER::addShape( const PCB_SHAPE* aShape, CONTAINER_2D_BASE* aConta
const BOARD_ITEM* aOwner )
{
// The full width of the lines to create
const float linewidth3DU = TO_3DU( aShape->GetWidth() );
LINE_STYLE lineStyle = aShape->GetStroke().GetLineStyle();
// The extra 1 protects the inner/outer radius values from degeneracy
const int linewidth = aShape->GetWidth() + 1;
PLOT_DASH_TYPE lineStyle = aShape->GetStroke().GetPlotStyle();
if( lineStyle <= LINE_STYLE::FIRST_TYPE )
if( lineStyle <= PLOT_DASH_TYPE::FIRST_TYPE )
{
switch( aShape->GetShape() )
{
case SHAPE_T::CIRCLE:
{
SFVEC2F center3DU = TO_SFVEC2F( aShape->GetCenter() );
float innerR3DU = TO_3DU( aShape->GetRadius() ) - linewidth3DU / 2.0;
float outerR3DU = TO_3DU( aShape->GetRadius() ) + linewidth3DU / 2.0;
const SFVEC2F center3DU = TO_SFVEC2F( aShape->GetCenter() );
float inner_radius3DU = TO_3DU( aShape->GetRadius() - linewidth / 2 );
float outer_radius3DU = TO_3DU( aShape->GetRadius() + linewidth / 2 );
if( aShape->IsFilled() || innerR3DU <= 0.0 )
addFILLED_CIRCLE_2D( aContainer, center3DU, outerR3DU, *aOwner );
else
addRING_2D( aContainer, center3DU, innerR3DU, outerR3DU, *aOwner );
if( inner_radius3DU < 0 )
inner_radius3DU = 0.0;
if( aShape->IsFilled() )
{
aContainer->Add( new FILLED_CIRCLE_2D( center3DU, outer_radius3DU,
*aOwner ) );
}
else if( outer_radius3DU > inner_radius3DU )
{
aContainer->Add( new RING_2D( center3DU, inner_radius3DU, outer_radius3DU,
*aOwner ) );
}
break;
}
case SHAPE_T::RECTANGLE:
case SHAPE_T::RECT:
if( aShape->IsFilled() )
{
SHAPE_POLY_SET polyList;
@@ -634,14 +669,14 @@ void BOARD_ADAPTER::addShape( const PCB_SHAPE* aShape, CONTAINER_2D_BASE* aConta
{
std::vector<VECTOR2I> pts = aShape->GetRectCorners();
addROUND_SEGMENT_2D( aContainer, TO_SFVEC2F( pts[0] ), TO_SFVEC2F( pts[1] ),
linewidth3DU, *aOwner );
addROUND_SEGMENT_2D( aContainer, TO_SFVEC2F( pts[1] ), TO_SFVEC2F( pts[2] ),
linewidth3DU, *aOwner );
addROUND_SEGMENT_2D( aContainer, TO_SFVEC2F( pts[2] ), TO_SFVEC2F( pts[3] ),
linewidth3DU, *aOwner );
addROUND_SEGMENT_2D( aContainer, TO_SFVEC2F( pts[3] ), TO_SFVEC2F( pts[0] ),
linewidth3DU, *aOwner );
aContainer->Add( new ROUND_SEGMENT_2D( TO_SFVEC2F( pts[0] ), TO_SFVEC2F( pts[1] ),
TO_3DU( linewidth ), *aOwner ) );
aContainer->Add( new ROUND_SEGMENT_2D( TO_SFVEC2F( pts[1] ), TO_SFVEC2F( pts[2] ),
TO_3DU( linewidth ), *aOwner ) );
aContainer->Add( new ROUND_SEGMENT_2D( TO_SFVEC2F( pts[2] ), TO_SFVEC2F( pts[3] ),
TO_3DU( linewidth ), *aOwner ) );
aContainer->Add( new ROUND_SEGMENT_2D( TO_SFVEC2F( pts[3] ), TO_SFVEC2F( pts[0] ),
TO_3DU( linewidth ), *aOwner ) );
}
break;
@@ -649,15 +684,33 @@ void BOARD_ADAPTER::addShape( const PCB_SHAPE* aShape, CONTAINER_2D_BASE* aConta
{
unsigned int segCount = GetCircleSegmentCount( aShape->GetBoundingBox().GetSizeMax() );
createArcSegments( aShape->GetCenter(), aShape->GetStart(), aShape->GetArcAngle(),
segCount, aShape->GetWidth(), aContainer, *aOwner );
transformArcToSegments( aShape->GetCenter(), aShape->GetStart(), aShape->GetArcAngle(),
segCount, linewidth, aContainer, *aOwner );
break;
}
case SHAPE_T::SEGMENT:
addROUND_SEGMENT_2D( aContainer, TO_SFVEC2F( aShape->GetStart() ),
TO_SFVEC2F( aShape->GetEnd() ), linewidth3DU, *aOwner );
{
const SFVEC2F start3DU = TO_SFVEC2F( aShape->GetStart() );
const SFVEC2F end3DU = TO_SFVEC2F( aShape->GetEnd() );
const double linewidth3DU = TO_3DU( linewidth );
if( linewidth3DU == 0.0 )
{
// Don't attempt to render degenerate shapes
}
else if( Is_segment_a_circle( start3DU, end3DU ) )
{
// Cannot add segments that have the same start and end point
aContainer->Add( new FILLED_CIRCLE_2D( start3DU, linewidth3DU / 2, *aOwner ) );
}
else
{
aContainer->Add( new ROUND_SEGMENT_2D( start3DU, end3DU, linewidth3DU, *aOwner ) );
}
break;
}
case SHAPE_T::BEZIER:
case SHAPE_T::POLY:
@@ -667,11 +720,6 @@ void BOARD_ADAPTER::addShape( const PCB_SHAPE* aShape, CONTAINER_2D_BASE* aConta
aShape->TransformShapeToPolygon( polyList, UNDEFINED_LAYER, 0, ARC_HIGH_DEF,
ERROR_INSIDE );
// Some polygons can be a bit complex (especially when coming from a
// picture ot a text converted to a polygon
// So call Simplify before calling ConvertPolygonToTriangles, just in case.
polyList.Simplify( SHAPE_POLY_SET::PM_FAST );
if( polyList.IsEmpty() ) // Just for caution
break;
@@ -685,11 +733,12 @@ void BOARD_ADAPTER::addShape( const PCB_SHAPE* aShape, CONTAINER_2D_BASE* aConta
break;
}
}
else
else if( linewidth > 0 )
{
std::vector<SHAPE*> shapes = aShape->MakeEffectiveShapes( true );
SFVEC2F a3DU;
SFVEC2F b3DU;
double width3DU = TO_3DU( linewidth );
const PCB_PLOT_PARAMS& plotParams = aShape->GetBoard()->GetPlotOptions();
KIGFX::PCB_RENDER_SETTINGS renderSettings;
@@ -699,11 +748,16 @@ void BOARD_ADAPTER::addShape( const PCB_SHAPE* aShape, CONTAINER_2D_BASE* aConta
for( SHAPE* shape : shapes )
{
STROKE_PARAMS::Stroke( shape, lineStyle, aShape->GetWidth(), &renderSettings,
STROKE_PARAMS::Stroke( shape, lineStyle, linewidth, &renderSettings,
[&]( const VECTOR2I& a, const VECTOR2I& b )
{
addROUND_SEGMENT_2D( aContainer, TO_SFVEC2F( a ), TO_SFVEC2F( b ),
linewidth3DU, *aOwner );
a3DU = TO_SFVEC2F( a );
b3DU = TO_SFVEC2F( b );
if( Is_segment_a_circle( a3DU, b3DU ) )
aContainer->Add( new FILLED_CIRCLE_2D( a3DU, width3DU / 2, *aOwner ) );
else
aContainer->Add( new ROUND_SEGMENT_2D( a3DU, b3DU, width3DU, *aOwner ) );
} );
}
@@ -713,38 +767,12 @@ void BOARD_ADAPTER::addShape( const PCB_SHAPE* aShape, CONTAINER_2D_BASE* aConta
}
void BOARD_ADAPTER::addShape( const PCB_TEXTBOX* aTextBox, CONTAINER_2D_BASE* aContainer,
const BOARD_ITEM* aOwner )
{
addText( aTextBox, aContainer, aOwner );
if( !aTextBox->IsBorderEnabled() )
return;
// We cannot use PCB_TEXTBOX::TransformShapeToPolygon because it convert the textbox
// as filled polygon even if there's no background colour.
// So for polygon, we use PCB_SHAPE::TransformShapeToPolygon
if( aTextBox->GetShape() == SHAPE_T::RECTANGLE )
addShape( static_cast<const PCB_SHAPE*>( aTextBox ), aContainer, aOwner );
else
{
SHAPE_POLY_SET polyList;
aTextBox->PCB_SHAPE::TransformShapeToPolygon( polyList, UNDEFINED_LAYER, 0,
ARC_HIGH_DEF, ERROR_INSIDE );
ConvertPolygonToTriangles( polyList, *aContainer, m_biuTo3Dunits, *aOwner );
}
}
void BOARD_ADAPTER::addSolidAreasShapes( const ZONE* aZone, CONTAINER_2D_BASE* aContainer,
PCB_LAYER_ID aLayerId )
{
// This convert the poly in outline and holes
ConvertPolygonToTriangles( *aZone->GetFilledPolysList( aLayerId ), *aContainer, m_biuTo3Dunits,
*aZone );
ConvertPolygonToTriangles( *aZone->GetFilledPolysList( aLayerId ), *aContainer,
m_biuTo3Dunits, *aZone );
}
@@ -755,23 +783,35 @@ void BOARD_ADAPTER::buildPadOutlineAsSegments( const PAD* aPad, CONTAINER_2D_BAS
{
const SFVEC2F center3DU = TO_SFVEC2F( aPad->ShapePos() );
const int radius = aPad->GetSize().x / 2;
const float inner_radius3DU = TO_3DU( radius - aWidth / 2.0 );
const float outer_radius3DU = TO_3DU( radius + aWidth / 2.0 );
const float inner_radius3DU = TO_3DU( radius - aWidth / 2 );
const float outer_radius3DU = TO_3DU( radius + aWidth / 2 );
addRING_2D( aContainer, center3DU, inner_radius3DU, outer_radius3DU, *aPad );
aContainer->Add( new RING_2D( center3DU, inner_radius3DU, outer_radius3DU, *aPad ) );
return;
}
else
// For other shapes, add outlines as thick segments in polygon buffer
const std::shared_ptr<SHAPE_POLY_SET>& corners = aPad->GetEffectivePolygon( ERROR_INSIDE );
const SHAPE_LINE_CHAIN& path = corners->COutline( 0 );
for( int j = 0; j < path.PointCount(); j++ )
{
// For other shapes, add outlines as thick segments in polygon buffer
const std::shared_ptr<SHAPE_POLY_SET>& corners = aPad->GetEffectivePolygon( ERROR_INSIDE );
const SHAPE_LINE_CHAIN& path = corners->COutline( 0 );
SFVEC2F start3DU = TO_SFVEC2F( path.CPoint( j ) );
SFVEC2F end3DU = TO_SFVEC2F( path.CPoint( j + 1 ) );
for( int j = 0; j < path.PointCount(); j++ )
if( aWidth == 0 )
{
SFVEC2F start3DU = TO_SFVEC2F( path.CPoint( j ) );
SFVEC2F end3DU = TO_SFVEC2F( path.CPoint( j + 1 ) );
addROUND_SEGMENT_2D( aContainer, start3DU, end3DU, TO_3DU( aWidth ), *aPad );
// Don't attempt to render degenerate shapes
}
else if( Is_segment_a_circle( start3DU, end3DU ) )
{
// Cannot add segments that have the same start and end point
aContainer->Add( new FILLED_CIRCLE_2D( start3DU, TO_3DU( aWidth / 2 ), *aPad ) );
}
else
{
aContainer->Add( new ROUND_SEGMENT_2D( start3DU, end3DU, TO_3DU( aWidth ), *aPad ) );
}
}
}
File diff suppressed because it is too large Load Diff
+89
View File
@@ -0,0 +1,89 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file create_layer_poly.cpp
* @brief This file implements the creation of the pcb board items in the poly
* contours format.
*/
#include "board_adapter.h"
#include <board_design_settings.h>
#include <convert_basic_shapes_to_polygon.h>
#include <fp_shape.h>
#include <footprint.h>
/*
* This is used to draw pad outlines on silk layers.
*/
void BOARD_ADAPTER::buildPadOutlineAsPolygon( const PAD* aPad, SHAPE_POLY_SET& aBuffer,
int aWidth ) const
{
int maxError = m_board->GetDesignSettings().m_MaxError;
if( aPad->GetShape() == PAD_SHAPE::CIRCLE ) // Draw a ring
{
TransformRingToPolygon( aBuffer, aPad->ShapePos(), aPad->GetSize().x / 2, aWidth, maxError,
ERROR_INSIDE );
return;
}
// For other shapes, add outlines as thick segments in polygon buffer
const std::shared_ptr<SHAPE_POLY_SET>& corners = aPad->GetEffectivePolygon( ERROR_INSIDE );
const SHAPE_LINE_CHAIN& path = corners->COutline( 0 );
for( int ii = 0; ii < path.PointCount(); ++ii )
{
const VECTOR2I& a = path.CPoint( ii );
const VECTOR2I& b = path.CPoint( ii + 1 );
TransformOvalToPolygon( aBuffer, a, b, aWidth, maxError, ERROR_INSIDE );
}
}
void BOARD_ADAPTER::transformFPShapesToPolySet( const FOOTPRINT* aFootprint, PCB_LAYER_ID aLayer,
SHAPE_POLY_SET& aBuffer ) const
{
int maxError = m_board->GetDesignSettings().m_MaxError;
for( BOARD_ITEM* item : aFootprint->GraphicalItems() )
{
if( item->Type() == PCB_FP_SHAPE_T )
{
FP_SHAPE* shape = static_cast<FP_SHAPE*>( item );
if( shape->GetLayer() == aLayer )
shape->TransformShapeToPolygon( aBuffer, aLayer, 0, maxError, ERROR_INSIDE );
}
else if( BaseType( item->Type() ) == PCB_DIMENSION_T )
{
PCB_DIMENSION_BASE* dimension = static_cast<PCB_DIMENSION_BASE*>( item );
if( dimension->GetLayer() == aLayer )
dimension->TransformShapeToPolygon( aBuffer, aLayer, 0, maxError, ERROR_INSIDE );
}
}
}
+77 -44
View File
@@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
* Copyright (C) 1992-2024 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -23,7 +23,7 @@
*/
#include <gal/opengl/kiglew.h> // Must be included first
#include <gal/opengl/gl_utils.h>
#include <gl_utils.h>
#include <wx/tokenzr.h>
#include "../common_ogl/ogl_utils.h"
@@ -35,10 +35,11 @@
#include <advanced_config.h>
#include <board.h>
#include <reporter.h>
#include <gal/opengl/gl_context_mgr.h>
#include <core/profile.h> // To use GetRunningMicroSecs or another profiling utility
#include <gl_context_mgr.h>
#include <profile.h> // To use GetRunningMicroSecs or another profiling utility
#include <bitmaps.h>
#include <macros.h>
#include <menus_helpers.h>
#include <pgm_base.h>
#include <settings/settings_manager.h>
#include <tool/tool_dispatcher.h>
@@ -70,7 +71,10 @@ BEGIN_EVENT_TABLE( EDA_3D_CANVAS, HIDPI_GL_3D_CANVAS )
EVT_MIDDLE_DOWN( EDA_3D_CANVAS::OnMiddleDown)
EVT_MOUSEWHEEL( EDA_3D_CANVAS::OnMouseWheel )
EVT_MOTION( EDA_3D_CANVAS::OnMouseMove )
#if wxCHECK_VERSION( 3, 1, 0 ) || defined( USE_OSX_MAGNIFY_EVENT )
EVT_MAGNIFY( EDA_3D_CANVAS::OnMagnify )
#endif
// other events
EVT_ERASE_BACKGROUND( EDA_3D_CANVAS::OnEraseBackground )
@@ -84,8 +88,7 @@ END_EVENT_TABLE()
EDA_3D_CANVAS::EDA_3D_CANVAS( wxWindow* aParent, const int* aAttribList,
BOARD_ADAPTER& aBoardAdapter, CAMERA& aCamera,
S3D_CACHE* a3DCachePointer ) :
HIDPI_GL_3D_CANVAS( EDA_DRAW_PANEL_GAL::GetVcSettings(), aCamera, aParent, wxID_ANY,
aAttribList, wxDefaultPosition,
HIDPI_GL_3D_CANVAS( aCamera, aParent, wxID_ANY, aAttribList, wxDefaultPosition,
wxDefaultSize, wxFULL_REPAINT_ON_RESIZE ),
m_eventDispatcher( nullptr ),
m_parentStatusBar( nullptr ),
@@ -153,7 +156,9 @@ EDA_3D_CANVAS::EDA_3D_CANVAS( wxWindow* aParent, const int* aAttribList,
wxEVT_RIGHT_UP, wxEVT_RIGHT_DOWN, wxEVT_RIGHT_DCLICK,
wxEVT_MIDDLE_UP, wxEVT_MIDDLE_DOWN, wxEVT_MIDDLE_DCLICK,
wxEVT_MOTION, wxEVT_MOUSEWHEEL, wxEVT_CHAR, wxEVT_CHAR_HOOK,
#if wxCHECK_VERSION( 3, 1, 0 ) || defined( USE_OSX_MAGNIFY_EVENT )
wxEVT_MAGNIFY,
#endif
wxEVT_MENU_OPEN, wxEVT_MENU_CLOSE, wxEVT_MENU_HIGHLIGHT
};
@@ -226,10 +231,10 @@ bool EDA_3D_CANVAS::initializeOpenGL()
else
{
wxLogTrace( m_logTrace, wxT( "EDA_3D_CANVAS::initializeOpenGL Using GLEW version %s" ),
From_UTF8( (char*) glewGetString( GLEW_VERSION ) ) );
FROM_UTF8( (char*) glewGetString( GLEW_VERSION ) ) );
}
wxString version = From_UTF8( (char *) glGetString( GL_VERSION ) );
wxString version = FROM_UTF8( (char *) glGetString( GL_VERSION ) );
wxLogTrace( m_logTrace, wxT( "EDA_3D_CANVAS::%s OpenGL version string %s." ),
__WXFUNCTION__, version );
@@ -330,9 +335,6 @@ void EDA_3D_CANVAS::DisplayStatus()
msg.Printf( wxT( "dy %3.2f" ), m_camera.GetCameraPos().y );
m_parentStatusBar->SetStatusText( msg, static_cast<int>( EDA_3D_VIEWER_STATUSBAR::Y_POS ) );
msg.Printf( wxT( "zoom %3.2f" ), 1 / m_camera.GetZoom() );
m_parentStatusBar->SetStatusText( msg, static_cast<int>( EDA_3D_VIEWER_STATUSBAR::ZOOM_LEVEL ) );
}
}
@@ -363,13 +365,16 @@ void EDA_3D_CANVAS::DoRePaint()
// therefore with invalid board.
// This is dependent of the platform.
// Especially on OSX, but also on Windows, it frequently happens
if( !GetParent()->GetParent()->IsShownOnScreen() )
if( !GetParent()->GetParent()->IsShown() )
return; // The parent board editor frame is no more alive
wxString err_messages;
wxString err_messages;
// !TODO: implement error reporter
INFOBAR_REPORTER warningReporter( m_parentInfoBar );
STATUSBAR_REPORTER activityReporter( m_parentStatusBar, EDA_3D_VIEWER_STATUSBAR::ACTIVITY );
int64_t start_time = GetRunningMicroSecs();
unsigned strtime = GetRunningMicroSecs();
// "Makes the OpenGL state that is represented by the OpenGL rendering
// context context current, i.e. it will be used by all subsequent OpenGL calls.
@@ -461,7 +466,7 @@ void EDA_3D_CANVAS::DoRePaint()
if( m_camera_is_moving )
{
const int64_t curtime_delta = GetRunningMicroSecs() - m_strtime_camera_movement;
const unsigned curtime_delta = GetRunningMicroSecs() - m_strtime_camera_movement;
curtime_delta_s = (curtime_delta / 1e6) * m_camera_moving_speed;
m_camera.Interpolate( curtime_delta_s );
@@ -527,9 +532,7 @@ void EDA_3D_CANVAS::DoRePaint()
render_pivot( curtime_delta_s, scale );
}
// This will only be enabled by the 3d mouse plugin, so we can leave
// it as a simple if statement
if( m_render3dmousePivot )
if( m_render3dmousePivot && ADVANCED_CFG::GetCfg().m_Use3DConnexionDriver )
{
const float scale = glm::min( m_camera.GetZoom(), 1.0f );
render3dmousePivot( scale );
@@ -542,13 +545,16 @@ void EDA_3D_CANVAS::DoRePaint()
GL_CONTEXT_MANAGER::Get().UnlockCtx( m_glRC );
if( m_mouse_was_moved || m_camera_is_moving )
if( !activityReporter.HasMessage() )
{
// Calculation time in milliseconds
const double calculation_time = (double)( GetRunningMicroSecs() - start_time ) / 1e3;
if( m_mouse_was_moved || m_camera_is_moving )
{
// Calculation time in milliseconds
const double calculation_time = (double)( GetRunningMicroSecs() - strtime) / 1e3;
activityReporter.Report( wxString::Format( _( "Last render time %.0f ms" ),
calculation_time ) );
activityReporter.Report( wxString::Format( _( "Last render time %.0f ms" ),
calculation_time ) );
}
}
// This will reset the flag of camera parameters changed
@@ -608,6 +614,7 @@ void EDA_3D_CANVAS::OnMouseWheel( wxMouseEvent& event )
}
#if wxCHECK_VERSION( 3, 1, 0 ) || defined( USE_OSX_MAGNIFY_EVENT )
void EDA_3D_CANVAS::OnMagnify( wxMouseEvent& event )
{
SetFocus();
@@ -625,13 +632,11 @@ void EDA_3D_CANVAS::OnMagnify( wxMouseEvent& event )
DisplayStatus();
Request_refresh();
}
#endif
void EDA_3D_CANVAS::OnMouseMove( wxMouseEvent& event )
{
if( m_3d_render && m_3d_render->IsReloadRequestPending() )
return; // Prevents using invalid m_3d_render_raytracing data
if( m_camera_is_moving )
return;
@@ -838,7 +843,7 @@ void EDA_3D_CANVAS::OnTimerTimeout_Redraw( wxTimerEvent& aEvent )
void EDA_3D_CANVAS::OnRefreshRequest( wxEvent& aEvent )
{
Refresh();
DoRePaint();
}
@@ -911,56 +916,68 @@ void EDA_3D_CANVAS::move_pivot_based_on_cur_mouse_position()
}
bool EDA_3D_CANVAS::SetView3D( VIEW3D_TYPE aRequestedView )
bool EDA_3D_CANVAS::SetView3D( int aKeycode )
{
if( m_camera_is_moving )
return false;
const float delta_move = m_delta_move_step_factor * m_camera.GetZoom();
const float arrow_moving_time_speed = 8.0f;
bool handled = false;
switch( aRequestedView )
switch( aKeycode )
{
case VIEW3D_TYPE::VIEW3D_PIVOT_CENTER:
case WXK_SPACE:
move_pivot_based_on_cur_mouse_position();
return true;
case VIEW3D_TYPE::VIEW3D_PAN_LEFT:
case WXK_LEFT:
m_camera.SetInterpolateMode( CAMERA_INTERPOLATION::LINEAR );
m_camera.SetT0_and_T1_current_T();
m_camera.Pan_T1( SFVEC3F( -delta_move, 0.0f, 0.0f ) );
request_start_moving_camera( arrow_moving_time_speed, false );
return true;
case VIEW3D_TYPE::VIEW3D_PAN_RIGHT:
case WXK_RIGHT:
m_camera.SetInterpolateMode( CAMERA_INTERPOLATION::LINEAR );
m_camera.SetT0_and_T1_current_T();
m_camera.Pan_T1( SFVEC3F( +delta_move, 0.0f, 0.0f ) );
request_start_moving_camera( arrow_moving_time_speed, false );
return true;
case VIEW3D_TYPE::VIEW3D_PAN_UP:
case WXK_UP:
m_camera.SetInterpolateMode( CAMERA_INTERPOLATION::LINEAR );
m_camera.SetT0_and_T1_current_T();
m_camera.Pan_T1( SFVEC3F( 0.0f, +delta_move, 0.0f ) );
request_start_moving_camera( arrow_moving_time_speed, false );
return true;
case VIEW3D_TYPE::VIEW3D_PAN_DOWN:
case WXK_DOWN:
m_camera.SetInterpolateMode( CAMERA_INTERPOLATION::LINEAR );
m_camera.SetT0_and_T1_current_T();
m_camera.Pan_T1( SFVEC3F( 0.0f, -delta_move, 0.0f ) );
request_start_moving_camera( arrow_moving_time_speed, false );
return true;
case VIEW3D_TYPE::VIEW3D_FIT_SCREEN:
case WXK_HOME:
m_camera.SetInterpolateMode( CAMERA_INTERPOLATION::BEZIER );
m_camera.SetT0_and_T1_current_T();
m_camera.Reset_T1();
request_start_moving_camera( glm::min( glm::max( m_camera.GetZoom(), 1 / 1.26f ), 1.26f ) );
return true;
case VIEW3D_TYPE::VIEW3D_ZOOM_IN:
case WXK_END:
break;
case WXK_TAB:
m_camera.SetInterpolateMode( CAMERA_INTERPOLATION::EASING_IN_OUT );
m_camera.SetT0_and_T1_current_T();
m_camera.RotateZ_T1( glm::radians( 45.0f ) );
request_start_moving_camera();
handled = true;
break;
case WXK_F1:
m_camera.SetInterpolateMode( CAMERA_INTERPOLATION::BEZIER );
m_camera.SetT0_and_T1_current_T();
@@ -969,7 +986,7 @@ bool EDA_3D_CANVAS::SetView3D( VIEW3D_TYPE aRequestedView )
return true;
case VIEW3D_TYPE::VIEW3D_ZOOM_OUT:
case WXK_F2:
m_camera.SetInterpolateMode( CAMERA_INTERPOLATION::BEZIER );
m_camera.SetT0_and_T1_current_T();
@@ -978,7 +995,14 @@ bool EDA_3D_CANVAS::SetView3D( VIEW3D_TYPE aRequestedView )
return true;
case VIEW3D_TYPE::VIEW3D_RIGHT:
case ID_VIEW3D_RESET:
m_camera.SetInterpolateMode( CAMERA_INTERPOLATION::BEZIER );
m_camera.SetT0_and_T1_current_T();
m_camera.Reset_T1();
request_start_moving_camera( glm::min( glm::max( m_camera.GetZoom(), 0.5f ), 1.125f ) );
return true;
case ID_VIEW3D_RIGHT:
m_camera.SetInterpolateMode( CAMERA_INTERPOLATION::BEZIER );
m_camera.SetT0_and_T1_current_T();
m_camera.Reset_T1();
@@ -987,7 +1011,7 @@ bool EDA_3D_CANVAS::SetView3D( VIEW3D_TYPE aRequestedView )
request_start_moving_camera();
return true;
case VIEW3D_TYPE::VIEW3D_LEFT:
case ID_VIEW3D_LEFT:
m_camera.SetInterpolateMode( CAMERA_INTERPOLATION::BEZIER );
m_camera.SetT0_and_T1_current_T();
m_camera.Reset_T1();
@@ -996,7 +1020,7 @@ bool EDA_3D_CANVAS::SetView3D( VIEW3D_TYPE aRequestedView )
request_start_moving_camera();
return true;
case VIEW3D_TYPE::VIEW3D_FRONT:
case ID_VIEW3D_FRONT:
m_camera.SetInterpolateMode( CAMERA_INTERPOLATION::BEZIER );
m_camera.SetT0_and_T1_current_T();
m_camera.Reset_T1();
@@ -1004,7 +1028,7 @@ bool EDA_3D_CANVAS::SetView3D( VIEW3D_TYPE aRequestedView )
request_start_moving_camera();
return true;
case VIEW3D_TYPE::VIEW3D_BACK:
case ID_VIEW3D_BACK:
m_camera.SetInterpolateMode( CAMERA_INTERPOLATION::BEZIER );
m_camera.SetT0_and_T1_current_T();
m_camera.Reset_T1();
@@ -1017,14 +1041,14 @@ bool EDA_3D_CANVAS::SetView3D( VIEW3D_TYPE aRequestedView )
request_start_moving_camera();
return true;
case VIEW3D_TYPE::VIEW3D_TOP:
case ID_VIEW3D_TOP:
m_camera.SetInterpolateMode( CAMERA_INTERPOLATION::BEZIER );
m_camera.SetT0_and_T1_current_T();
m_camera.Reset_T1();
request_start_moving_camera( glm::min( glm::max( m_camera.GetZoom(), 0.5f ), 1.125f ) );
return true;
case VIEW3D_TYPE::VIEW3D_BOTTOM:
case ID_VIEW3D_BOTTOM:
m_camera.SetInterpolateMode( CAMERA_INTERPOLATION::BEZIER );
m_camera.SetT0_and_T1_current_T();
m_camera.Reset_T1();
@@ -1032,7 +1056,7 @@ bool EDA_3D_CANVAS::SetView3D( VIEW3D_TYPE aRequestedView )
request_start_moving_camera( glm::min( glm::max( m_camera.GetZoom(), 0.5f ), 1.125f ) );
return true;
case VIEW3D_TYPE::VIEW3D_FLIP:
case ID_VIEW3D_FLIP:
m_camera.SetInterpolateMode( CAMERA_INTERPOLATION::BEZIER );
m_camera.SetT0_and_T1_current_T();
m_camera.RotateY_T1( glm::radians( 179.999f ) );
@@ -1042,6 +1066,15 @@ bool EDA_3D_CANVAS::SetView3D( VIEW3D_TYPE aRequestedView )
default:
return false;
}
m_mouse_was_moved = true;
restart_editingTimeOut_Timer();
DisplayStatus();
Request_refresh();
return handled;
}
+14 -9
View File
@@ -114,12 +114,12 @@ public:
void GetScreenshot( wxImage& aDstImage );
/**
* Select a specific 3D view or operation
* Helper function to call view commands.
*
* @param aRequestedView the view to move to
* @return true if the view request was handled, false if no command found for this view.
* @param aKeycode ascii key commands.
* @return true if the key code was handled, false if no command found for this code.
*/
bool SetView3D( VIEW3D_TYPE aRequestedView );
bool SetView3D( int aKeycode );
/**
* Enable or disable camera animation when switching to a pre-defined view.
@@ -208,6 +208,12 @@ public:
m_3dmousePivotPos = aPos;
}
private:
/**
* Called by a wxPaintEvent event
*/
void OnPaint( wxPaintEvent& aEvent );
/**
* The actual function to repaint the canvas.
*
@@ -216,17 +222,16 @@ public:
*/
void DoRePaint();
private:
// The wxPaintEvent event. mainly calls DoRePaint()
void OnPaint( wxPaintEvent& aEvent );
void OnEraseBackground( wxEraseEvent& event );
void OnRefreshRequest( wxEvent& aEvent );
void OnMouseWheel( wxMouseEvent& event );
#if wxCHECK_VERSION( 3, 1, 0 ) || defined( USE_OSX_MAGNIFY_EVENT )
void OnMagnify( wxMouseEvent& event );
#endif
void OnMouseMove( wxMouseEvent& event );
void OnLeftDown( wxMouseEvent& event );
void OnLeftUp( wxMouseEvent& event );
@@ -305,7 +310,7 @@ private:
bool m_render_pivot; // Render the pivot while camera moving
float m_camera_moving_speed; // 1.0f will be 1:1
int64_t m_strtime_camera_movement; // Ticktime of camera movement start
unsigned m_strtime_camera_movement; // Ticktime of camera movement start
bool m_animation_enabled; // Camera animation enabled
int m_moving_speed_multiplier; // Camera animation speed multiplier option
-24
View File
@@ -74,28 +74,4 @@ enum class MATERIAL_MODE
CAD_MODE = 2 ///< Use a gray shading based on diffuse material
};
enum class VIEW3D_TYPE
{
// Specific directions
VIEW3D_TOP,
VIEW3D_BOTTOM,
VIEW3D_LEFT,
VIEW3D_RIGHT,
VIEW3D_FRONT,
VIEW3D_BACK,
VIEW3D_FLIP,
// Movement commands
VIEW3D_PAN_UP,
VIEW3D_PAN_DOWN,
VIEW3D_PAN_LEFT,
VIEW3D_PAN_RIGHT,
VIEW3D_ZOOM_IN,
VIEW3D_ZOOM_OUT,
VIEW3D_PIVOT_CENTER,
// Specific levels
VIEW3D_FIT_SCREEN
};
#endif // _3D_ENUMS_H_
@@ -35,11 +35,10 @@
#include "../3d_cache/3d_cache.h"
#include <wx/dcclient.h>
#include <base_units.h>
#include <gal/opengl/gl_context_mgr.h>
#include <gl_context_mgr.h>
#include <settings/common_settings.h>
#include <pgm_base.h>
#include <dpi_scaling_common.h>
#include <class_draw_panel_gal.h>
#include <gal/dpi_scaling.h>
#include <macros.h>
/**
@@ -87,8 +86,7 @@ END_EVENT_TABLE()
EDA_3D_MODEL_VIEWER::EDA_3D_MODEL_VIEWER( wxWindow* aParent, const int* aAttribList,
S3D_CACHE* aCacheManager ) :
HIDPI_GL_CANVAS( EDA_DRAW_PANEL_GAL::GetVcSettings(), aParent, wxID_ANY, aAttribList,
wxDefaultPosition, wxDefaultSize,
HIDPI_GL_CANVAS( aParent, wxID_ANY, aAttribList, wxDefaultPosition, wxDefaultSize,
wxFULL_REPAINT_ON_RESIZE ),
m_trackBallCamera( RANGE_SCALE_3D * 4.0f ),
m_cacheManager( aCacheManager )
@@ -105,7 +103,7 @@ EDA_3D_MODEL_VIEWER::EDA_3D_MODEL_VIEWER( wxWindow* aParent, const int* aAttribL
COMMON_SETTINGS* settings = Pgm().GetCommonSettings();
const DPI_SCALING_COMMON dpi{ settings, this };
const DPI_SCALING dpi{ settings, this };
SetScaleFactor( dpi.GetScaleFactor() );
}
@@ -197,7 +195,7 @@ void EDA_3D_MODEL_VIEWER::ogl_initialize()
else
{
wxLogTrace( m_logTrace, wxT( "EDA_3D_MODEL_VIEWER::ogl_initialize Using GLEW version %s" ),
From_UTF8( (char*) glewGetString( GLEW_VERSION ) ) );
FROM_UTF8( (char*) glewGetString( GLEW_VERSION ) ) );
}
glHint( GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST );
@@ -402,16 +400,16 @@ void EDA_3D_MODEL_VIEWER::OnMouseWheel( wxMouseEvent& event )
if( event.ShiftDown() )
{
//if( event.GetWheelRotation() < 0 )
//SetView3D( VIEW_3D_TYPE::VIEW3D_PAN_UP ); // move up
//SetView3D( WXK_UP ); // move up
//else
//SetView3D( VIEW_3D_TYPE::VIEW3D_PAN_DOWN ); // move down
//SetView3D( WXK_DOWN ); // move down
}
else if( event.ControlDown() )
{
//if( event.GetWheelRotation() > 0 )
//SetView3D( VIEW_3D_TYPE::VIEW3D_PAN_RIGHT ); // move right
//SetView3D( WXK_RIGHT ); // move right
//else
//SetView3D( VIEW_3D_TYPE::VIEW3D_PAN_LEFT ); // move left
//SetView3D( WXK_LEFT ); // move left
}
else
{
@@ -23,7 +23,7 @@
*/
/**
* @file eda_3d_model_viewer.h
* @file c3d_model_viewer.h
* @brief Implements a model viewer canvas.
*
* The purpose of model viewer is to render 3d models that come in the original data from
+2 -7
View File
@@ -21,17 +21,12 @@
#include "nl_3d_viewer_plugin.h"
#include "nl_3d_viewer_plugin_impl.h"
#include <advanced_config.h>
#include <kiplatform/drivers.h>
NL_3D_VIEWER_PLUGIN::NL_3D_VIEWER_PLUGIN( EDA_3D_CANVAS* aViewport )
: m_impl( nullptr )
{
if( ADVANCED_CFG::GetCfg().m_Use3DConnexionDriver
&& KIPLATFORM::DRIVERS::Valid3DConnexionDriverVersion() )
{
if( ADVANCED_CFG::GetCfg().m_Use3DConnexionDriver )
m_impl = new NL_3D_VIEWER_PLUGIN_IMPL( aViewport );
}
}
@@ -43,6 +38,6 @@ NL_3D_VIEWER_PLUGIN::~NL_3D_VIEWER_PLUGIN()
void NL_3D_VIEWER_PLUGIN::SetFocus( bool focus )
{
if( m_impl )
if( ADVANCED_CFG::GetCfg().m_Use3DConnexionDriver )
m_impl->SetFocus( focus );
}
@@ -73,10 +73,7 @@ bool equals( glm::mat<L, C, T, Q> const& aFirst, glm::mat<L, C, T, Q> const& aSe
NL_3D_VIEWER_PLUGIN_IMPL::NL_3D_VIEWER_PLUGIN_IMPL( EDA_3D_CANVAS* aCanvas ) :
NAV_3D( false, false ),
m_canvas( aCanvas ),
m_capIsMoving( false ),
m_newWidth( 0.0 )
NAV_3D( false, false ), m_canvas( aCanvas ), m_capIsMoving( false )
{
m_camera = dynamic_cast<TRACK_BALL*>( m_canvas->GetCamera() );
@@ -176,7 +173,7 @@ void NL_3D_VIEWER_PLUGIN_IMPL::exportCommandsAndImages()
for( it = actions.begin(); it != actions.end(); ++it )
{
const TOOL_ACTION* action = *it;
std::string label = action->GetMenuLabel().ToStdString();
std::string label = action->GetLabel().ToStdString();
if( label.empty() )
{
@@ -591,7 +588,7 @@ long NL_3D_VIEWER_PLUGIN_IMPL::SetActiveCommand( std::string commandId )
if( runAction )
{
tool_manager->RunAction( *context );
tool_manager->RunAction( *context, true );
m_canvas->Request_refresh();
}
}
@@ -26,7 +26,7 @@
* @file camera.cpp
*/
#include <gal/3d/camera.h>
#include "camera.h"
#include <wx/log.h>
#include <algorithm>
@@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
* Copyright (C) 2015-2023 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2015-2020 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -30,8 +30,7 @@
#ifndef CAMERA_H
#define CAMERA_H
#include <gal/gal.h>
#include <plugins/3dapi/xv3d_types.h>
#include "../3d_rendering/raytracing/ray.h"
#include <wx/gdicmn.h> // for wxSize
#include <vector>
@@ -59,29 +58,6 @@ struct CAMERA_FRUSTUM
SFVEC3F fbr; ///< Far Bottom Right
float nearD, farD, ratio, angle, tang;
float nw, nh, fw, fh;
CAMERA_FRUSTUM() :
nc( { 0.0, 0.0, 0.0 } ),
fc( { 0.0, 0.0, 0.0 } ),
ntl( { 0.0, 0.0, 0.0 } ),
ntr( { 0.0, 0.0, 0.0 } ),
nbl( { 0.0, 0.0, 0.0 } ),
nbr( { 0.0, 0.0, 0.0 } ),
ftl( { 0.0, 0.0, 0.0 } ),
ftr( { 0.0, 0.0, 0.0 } ),
fbl( { 0.0, 0.0, 0.0 } ),
fbr( { 0.0, 0.0, 0.0 } ),
nearD( 0.0 ),
farD( 0.0 ),
ratio( 1.0 ),
angle( 0.0 ),
tang( 0.0 ),
nw( 0.0 ),
nh( 0.0 ),
fw( 0.0 ),
fh( 0.0 )
{
}
};
@@ -98,7 +74,7 @@ enum class CAMERA_INTERPOLATION
*
* It must be derived by other classes to implement a real camera object.
*/
class GAL_API CAMERA
class CAMERA
{
public:
static const float DEFAULT_MIN_ZOOM;
+6 -5
View File
@@ -24,7 +24,8 @@
*/
/**
* @file 3d_model.cpp
* @file c_ogl_3dmodel.cpp
* @brief
*/
#include <algorithm>
#include <stdexcept>
@@ -447,7 +448,7 @@ void MODEL_3D::Draw( bool aTransparent, float aOpacity, bool aUseSelectedMateria
glTexEnvfv( GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, (const float*)&param.x );
std::vector<const MODEL_3D::MATERIAL *> materialsToRender;
materialsToRender.reserve( m_materials.size() );
if( aModelWorldMatrix && aCameraWorldPos )
@@ -521,10 +522,10 @@ void MODEL_3D::Draw( bool aTransparent, float aOpacity, bool aUseSelectedMateria
{
continue;
}
materialsToRender.push_back( &mat );
}
}
}
for( const MODEL_3D::MATERIAL* mat : materialsToRender )
{
@@ -603,7 +604,7 @@ void MODEL_3D::DrawBboxes() const
: sizeof( GLuint );
glDrawElements( GL_LINES, bbox_idx_count * m_meshes_bbox.size(), m_bbox_index_buffer_type,
reinterpret_cast<const void*>(
reinterpret_cast<const void*>(
static_cast<uintptr_t>( bbox_idx_count * idx_size ) ) );
}
+122 -107
View File
@@ -2,8 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
* Copyright (C) 2023 CERN
* Copyright (C) 2015-2023 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2015-2022 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -24,24 +23,25 @@
*/
#include "render_3d_opengl.h"
#include "opengl_utils.h"
#include <board.h>
#include <footprint.h>
#include "../../3d_math.h"
#include "convert_basic_shapes_to_polygon.h"
#include <trigo.h>
#include <project.h>
#include <core/profile.h> // To use GetRunningMicroSecs or another profiling utility
#include <profile.h> // To use GetRunningMicroSecs or another profiling utility
#include <fp_lib_table.h>
#include <eda_3d_canvas.h>
#include <eda_3d_viewer_frame.h>
#include <project_pcb.h>
void RENDER_3D_OPENGL::addObjectTriangles( const FILLED_CIRCLE_2D* aCircle,
void RENDER_3D_OPENGL::addObjectTriangles( const FILLED_CIRCLE_2D* aFilledCircle,
TRIANGLE_DISPLAY_LIST* aDstLayer, float aZtop,
float aZbot )
{
const SFVEC2F& center = aCircle->GetCenter();
const float radius = aCircle->GetRadius() * 2.0f; // Double because the render triangle
const SFVEC2F& center = aFilledCircle->GetCenter();
const float radius = aFilledCircle->GetRadius() * 2.0f; // Double because the render triangle
// This is a small adjustment to the circle texture
const float texture_factor = ( 8.0f / (float) SIZE_OF_CIRCLE_TEXTURE ) + 1.0f;
@@ -303,7 +303,7 @@ OPENGL_RENDER_LIST* RENDER_3D_OPENGL::generateHoles( const LIST_OBJECT2D& aListH
OPENGL_RENDER_LIST* RENDER_3D_OPENGL::generateLayerList( const BVH_CONTAINER_2D* aContainer,
const SHAPE_POLY_SET* aPolyList,
PCB_LAYER_ID aLayer,
PCB_LAYER_ID aLayerId,
const BVH_CONTAINER_2D* aThroughHoles )
{
if( aContainer == nullptr )
@@ -317,7 +317,7 @@ OPENGL_RENDER_LIST* RENDER_3D_OPENGL::generateLayerList( const BVH_CONTAINER_2D*
float layer_z_bot = 0.0f;
float layer_z_top = 0.0f;
getLayerZPos( aLayer, layer_z_top, layer_z_bot );
getLayerZPos( aLayerId, layer_z_top, layer_z_bot );
// Calculate an estimation for the nr of triangles based on the nr of objects
unsigned int nrTrianglesEstimation = listObject2d.size() * 8;
@@ -376,12 +376,12 @@ OPENGL_RENDER_LIST* RENDER_3D_OPENGL::generateLayerList( const BVH_CONTAINER_2D*
}
OPENGL_RENDER_LIST* RENDER_3D_OPENGL::generateEmptyLayerList( PCB_LAYER_ID aLayer )
OPENGL_RENDER_LIST* RENDER_3D_OPENGL::generateEmptyLayerList( PCB_LAYER_ID aLayerId )
{
float layer_z_bot = 0.0f;
float layer_z_top = 0.0f;
getLayerZPos( aLayer, layer_z_top, layer_z_bot );
getLayerZPos( aLayerId, layer_z_top, layer_z_bot );
TRIANGLE_DISPLAY_LIST* layerTriangles = new TRIANGLE_DISPLAY_LIST( 1 );
@@ -454,7 +454,7 @@ void RENDER_3D_OPENGL::reload( REPORTER* aStatusReporter, REPORTER* aWarningRepo
OBJECT_2D_STATS::Instance().ResetStats();
int64_t stats_startReloadTime = GetRunningMicroSecs();
unsigned stats_startReloadTime = GetRunningMicroSecs();
m_boardAdapter.InitSettings( aStatusReporter, aWarningReporter );
@@ -465,23 +465,28 @@ void RENDER_3D_OPENGL::reload( REPORTER* aStatusReporter, REPORTER* aWarningRepo
aStatusReporter->Report( _( "Load OpenGL: board" ) );
// Create Board
m_board = createBoard( m_boardAdapter.GetBoardPoly(), &m_boardAdapter.GetTH_IDs() );
m_board = createBoard( m_boardAdapter.GetBoardPoly(), &m_boardAdapter.GetThroughHoleIds() );
m_antiBoardPolys.RemoveAllContours();
m_antiBoardPolys.NewOutline();
m_antiBoardPolys.Append( VECTOR2I( -INT_MAX/2, -INT_MAX/2 ) );
m_antiBoardPolys.Append( VECTOR2I( INT_MAX/2, -INT_MAX/2 ) );
m_antiBoardPolys.Append( VECTOR2I( INT_MAX/2, INT_MAX/2 ) );
m_antiBoardPolys.Append( VECTOR2I( -INT_MAX/2, INT_MAX/2 ) );
m_antiBoardPolys.Outline( 0 ).SetClosed( true );
if( m_boardAdapter.m_Cfg->m_Render.realistic )
{
m_antiBoardPolys.RemoveAllContours();
m_antiBoardPolys.NewOutline();
m_antiBoardPolys.Append( VECTOR2I( -INT_MAX/2, -INT_MAX/2 ) );
m_antiBoardPolys.Append( VECTOR2I( INT_MAX/2, -INT_MAX/2 ) );
m_antiBoardPolys.Append( VECTOR2I( INT_MAX/2, INT_MAX/2 ) );
m_antiBoardPolys.Append( VECTOR2I( -INT_MAX/2, INT_MAX/2 ) );
m_antiBoardPolys.Outline( 0 ).SetClosed( true );
m_antiBoardPolys.BooleanSubtract( m_boardAdapter.GetBoardPoly(),
SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
m_antiBoard = createBoard( m_antiBoardPolys );
m_antiBoardPolys.BooleanSubtract( m_boardAdapter.GetBoardPoly(),
SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
m_antiBoard = createBoard( m_antiBoardPolys );
}
SHAPE_POLY_SET board_poly_with_holes = m_boardAdapter.GetBoardPoly().CloneDropTriangulation();
board_poly_with_holes.BooleanSubtract( m_boardAdapter.GetTH_ODPolys(), SHAPE_POLY_SET::PM_FAST );
board_poly_with_holes.BooleanSubtract( m_boardAdapter.GetNPTH_ODPolys(), SHAPE_POLY_SET::PM_FAST );
board_poly_with_holes.BooleanSubtract( m_boardAdapter.GetThroughHoleOdPolys(),
SHAPE_POLY_SET::PM_FAST );
board_poly_with_holes.BooleanSubtract( m_boardAdapter.GetOuterNonPlatedThroughHolePoly(),
SHAPE_POLY_SET::PM_FAST );
m_boardWithHoles = createBoard( board_poly_with_holes );
@@ -492,22 +497,28 @@ void RENDER_3D_OPENGL::reload( REPORTER* aStatusReporter, REPORTER* aWarningRepo
if( aStatusReporter )
aStatusReporter->Report( _( "Load OpenGL: holes and vias" ) );
SHAPE_POLY_SET outerPolyTHT = m_boardAdapter.GetTH_ODPolys().CloneDropTriangulation();
SHAPE_POLY_SET outerPolyTHT = m_boardAdapter.GetThroughHoleOdPolys().CloneDropTriangulation();
outerPolyTHT.BooleanIntersection( m_boardAdapter.GetBoardPoly(),
SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
m_outerThroughHoles = generateHoles( m_boardAdapter.GetTH_ODs().GetList(), outerPolyTHT,
1.0f, 0.0f, false, &m_boardAdapter.GetTH_IDs() );
m_outerViaThroughHoles = generateHoles( m_boardAdapter.GetViaTH_ODs().GetList(),
m_boardAdapter.GetViaTH_ODPolys(), 1.0f, 0.0f, false );
if( m_boardAdapter.m_Cfg->m_Render.clip_silk_on_via_annuli )
if( m_boardAdapter.m_Cfg->m_Render.realistic )
{
m_outerThroughHoleRings = generateHoles( m_boardAdapter.GetViaAnnuli().GetList(),
m_boardAdapter.GetViaAnnuliPolys(),
1.0f, 0.0f, false );
outerPolyTHT.BooleanIntersection( m_boardAdapter.GetBoardPoly(),
SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
}
m_outerThroughHoles = generateHoles( m_boardAdapter.GetThroughHoleOds().GetList(),
outerPolyTHT, 1.0f, 0.0f, false,
&m_boardAdapter.GetThroughHoleIds() );
m_outerViaThroughHoles = generateHoles(
m_boardAdapter.GetThroughHoleViaOds().GetList(),
m_boardAdapter.GetThroughHoleViaOdPolys(), 1.0f, 0.0f, false );
if( m_boardAdapter.m_Cfg->m_Render.clip_silk_on_via_annulus &&
m_boardAdapter.m_Cfg->m_Render.realistic )
{
m_outerThroughHoleRings = generateHoles(
m_boardAdapter.GetThroughHoleAnnularRings().GetList(),
m_boardAdapter.GetThroughHoleAnnularRingPolys(), 1.0f, 0.0f, false );
}
const MAP_POLY& innerMapHoles = m_boardAdapter.GetHoleIdPolysMap();
@@ -522,20 +533,28 @@ void RENDER_3D_OPENGL::reload( REPORTER* aStatusReporter, REPORTER* aWarningRepo
float layer_z_bot = 0.0f;
float layer_z_top = 0.0f;
for( const auto& [ layer, poly ] : outerMapHoles )
for( const std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET*>& ii : outerMapHoles )
{
getLayerZPos( layer, layer_z_top, layer_z_bot );
const PCB_LAYER_ID layer_id = ii.first;
const SHAPE_POLY_SET* poly = ii.second;
const BVH_CONTAINER_2D* container = map_holes.at( layer_id );
m_outerLayerHoles[layer] = generateHoles( map_holes.at( layer )->GetList(), *poly,
layer_z_top, layer_z_bot, false );
getLayerZPos( layer_id, layer_z_top, layer_z_bot );
m_outerLayerHoles[layer_id] = generateHoles( container->GetList(), *poly,
layer_z_top, layer_z_bot, false );
}
for( const auto& [ layer, poly ] : innerMapHoles )
for( const std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET*>& ii : innerMapHoles )
{
getLayerZPos( layer, layer_z_top, layer_z_bot );
const PCB_LAYER_ID layer_id = ii.first;
const SHAPE_POLY_SET* poly = ii.second;
const BVH_CONTAINER_2D* container = map_holes.at( layer_id );
m_innerLayerHoles[layer] = generateHoles( map_holes.at( layer )->GetList(), *poly,
layer_z_top, layer_z_bot, false );
getLayerZPos( layer_id, layer_z_top, layer_z_bot );
m_innerLayerHoles[layer_id] = generateHoles( container->GetList(), *poly,
layer_z_top, layer_z_bot, false );
}
}
@@ -546,98 +565,107 @@ void RENDER_3D_OPENGL::reload( REPORTER* aStatusReporter, REPORTER* aWarningRepo
if( aStatusReporter )
aStatusReporter->Report( _( "Load OpenGL: layers" ) );
std::bitset<LAYER_3D_END> visibilityFlags = m_boardAdapter.GetVisibleLayers();
const MAP_POLY& map_poly = m_boardAdapter.GetPolyMap();
wxString msg;
const MAP_POLY& map_poly = m_boardAdapter.GetPolyMap();
for( const auto& [ layer, container2d ] : m_boardAdapter.GetLayerMap() )
for( const std::pair<const PCB_LAYER_ID, BVH_CONTAINER_2D*>& ii : m_boardAdapter.GetLayerMap() )
{
if( !m_boardAdapter.Is3dLayerEnabled( layer, visibilityFlags ) )
const PCB_LAYER_ID layer_id = ii.first;
if( !m_boardAdapter.Is3dLayerEnabled( layer_id ) )
continue;
if( aStatusReporter )
{
msg = m_boardAdapter.GetBoard()->GetLayerName( layer );
aStatusReporter->Report( wxString::Format( _( "Load OpenGL layer %s" ), msg ) );
aStatusReporter->Report( wxString::Format( _( "Load OpenGL layer %d" ),
(int) layer_id ) );
}
const BVH_CONTAINER_2D* container2d = ii.second;
SHAPE_POLY_SET polyListSubtracted;
SHAPE_POLY_SET* polyList = nullptr;
// Load the vertical (Z axis) component of shapes
if( m_boardAdapter.m_Cfg->m_Render.opengl_copper_thickness )
if( map_poly.find( layer_id ) != map_poly.end() )
{
if( map_poly.find( layer ) != map_poly.end() )
polyListSubtracted = *map_poly.at( layer_id );;
if( m_boardAdapter.m_Cfg->m_Render.realistic )
{
polyListSubtracted = *map_poly.at( layer );
if( LSET::PhysicalLayersMask().test( layer ) )
{
polyListSubtracted.BooleanIntersection( m_boardAdapter.GetBoardPoly(),
SHAPE_POLY_SET::PM_FAST );
}
if( layer != B_Mask && layer != F_Mask )
{
polyListSubtracted.BooleanSubtract( m_boardAdapter.GetTH_ODPolys(),
polyListSubtracted.BooleanIntersection( m_boardAdapter.GetBoardPoly(),
SHAPE_POLY_SET::PM_FAST );
polyListSubtracted.BooleanSubtract( m_boardAdapter.GetNPTH_ODPolys(),
if( layer_id != B_Mask && layer_id != F_Mask )
{
polyListSubtracted.BooleanSubtract( m_boardAdapter.GetThroughHoleOdPolys(),
SHAPE_POLY_SET::PM_FAST );
polyListSubtracted.BooleanSubtract( m_boardAdapter.GetOuterNonPlatedThroughHolePoly(),
SHAPE_POLY_SET::PM_FAST );
}
if( m_boardAdapter.m_Cfg->m_Render.subtract_mask_from_silk )
{
if( layer == B_SilkS && map_poly.find( B_Mask ) != map_poly.end() )
if( layer_id == B_SilkS && map_poly.find( B_Mask ) != map_poly.end() )
{
polyListSubtracted.BooleanSubtract( *map_poly.at( B_Mask ),
SHAPE_POLY_SET::PM_FAST );
}
else if( layer == F_SilkS && map_poly.find( F_Mask ) != map_poly.end() )
else if( layer_id == F_SilkS && map_poly.find( F_Mask ) != map_poly.end() )
{
polyListSubtracted.BooleanSubtract( *map_poly.at( F_Mask ),
SHAPE_POLY_SET::PM_FAST );
}
}
polyList = &polyListSubtracted;
}
polyList = &polyListSubtracted;
}
OPENGL_RENDER_LIST* oglList = generateLayerList( container2d, polyList, layer,
&m_boardAdapter.GetTH_IDs() );
OPENGL_RENDER_LIST* oglList = generateLayerList( container2d, polyList, layer_id,
&m_boardAdapter.GetThroughHoleIds() );
if( oglList != nullptr )
m_layers[layer] = oglList;
m_layers[layer_id] = oglList;
}
if( m_boardAdapter.m_Cfg->m_Render.differentiate_plated_copper )
if( m_boardAdapter.m_Cfg->m_Render.renderPlatedPadsAsPlated
&& m_boardAdapter.m_Cfg->m_Render.realistic )
{
const SHAPE_POLY_SET* frontPlatedPadAndGraphicPolys = m_boardAdapter.GetFrontPlatedPadAndGraphicPolys();
const SHAPE_POLY_SET* backPlatedPadAndGraphicPolys = m_boardAdapter.GetBackPlatedPadAndGraphicPolys();
const SHAPE_POLY_SET* frontPlatedPadPolys = m_boardAdapter.GetFrontPlatedPadPolys();
const SHAPE_POLY_SET* backPlatedPadPolys = m_boardAdapter.GetBackPlatedPadPolys();
if( frontPlatedPadAndGraphicPolys )
if( frontPlatedPadPolys )
{
SHAPE_POLY_SET poly = frontPlatedPadAndGraphicPolys->CloneDropTriangulation();
poly.BooleanIntersection( m_boardAdapter.GetBoardPoly(), SHAPE_POLY_SET::PM_FAST );
poly.BooleanSubtract( m_boardAdapter.GetTH_ODPolys(), SHAPE_POLY_SET::PM_FAST );
poly.BooleanSubtract( m_boardAdapter.GetNPTH_ODPolys(), SHAPE_POLY_SET::PM_FAST );
SHAPE_POLY_SET polySubtracted = frontPlatedPadPolys->CloneDropTriangulation();
polySubtracted.BooleanIntersection( m_boardAdapter.GetBoardPoly(),
SHAPE_POLY_SET::PM_FAST );
polySubtracted.BooleanSubtract( m_boardAdapter.GetThroughHoleOdPolys(),
SHAPE_POLY_SET::PM_FAST );
polySubtracted.BooleanSubtract( m_boardAdapter.GetOuterNonPlatedThroughHolePoly(),
SHAPE_POLY_SET::PM_FAST );
m_platedPadsFront = generateLayerList( m_boardAdapter.GetPlatedPadsFront(), &poly, F_Cu );
m_platedPadsFront = generateLayerList( m_boardAdapter.GetPlatedPadsFront(),
&polySubtracted, F_Cu );
// An entry for F_Cu must exist in m_layers or we'll never look at m_platedPadsFront
if( m_layers.count( F_Cu ) == 0 )
m_layers[F_Cu] = generateEmptyLayerList( F_Cu );
}
if( backPlatedPadAndGraphicPolys )
if( backPlatedPadPolys )
{
SHAPE_POLY_SET poly = backPlatedPadAndGraphicPolys->CloneDropTriangulation();
poly.BooleanIntersection( m_boardAdapter.GetBoardPoly(), SHAPE_POLY_SET::PM_FAST );
poly.BooleanSubtract( m_boardAdapter.GetTH_ODPolys(), SHAPE_POLY_SET::PM_FAST );
poly.BooleanSubtract( m_boardAdapter.GetNPTH_ODPolys(), SHAPE_POLY_SET::PM_FAST );
SHAPE_POLY_SET polySubtracted = backPlatedPadPolys->CloneDropTriangulation();
polySubtracted.BooleanIntersection( m_boardAdapter.GetBoardPoly(),
SHAPE_POLY_SET::PM_FAST );
polySubtracted.BooleanSubtract( m_boardAdapter.GetThroughHoleOdPolys(),
SHAPE_POLY_SET::PM_FAST );
polySubtracted.BooleanSubtract( m_boardAdapter.GetOuterNonPlatedThroughHolePoly(),
SHAPE_POLY_SET::PM_FAST );
m_platedPadsBack = generateLayerList( m_boardAdapter.GetPlatedPadsBack(), &poly, B_Cu );
m_platedPadsBack = generateLayerList( m_boardAdapter.GetPlatedPadsBack(),
&polySubtracted, B_Cu );
// An entry for B_Cu must exist in m_layers or we'll never look at m_platedPadsBack
if( m_layers.count( B_Cu ) == 0 )
@@ -645,15 +673,6 @@ void RENDER_3D_OPENGL::reload( REPORTER* aStatusReporter, REPORTER* aWarningRepo
}
}
if( m_boardAdapter.m_Cfg->m_Render.show_off_board_silk )
{
if( const BVH_CONTAINER_2D* padsFront = m_boardAdapter.GetOffboardPadsFront() )
m_offboardPadsFront = generateLayerList( padsFront, nullptr, F_Cu );
if( const BVH_CONTAINER_2D* padsBack = m_boardAdapter.GetOffboardPadsBack() )
m_offboardPadsBack = generateLayerList( padsBack, nullptr, B_Cu );
}
// Load 3D models
if( aStatusReporter )
aStatusReporter->Report( _( "Loading 3D models..." ) );
@@ -840,7 +859,8 @@ void RENDER_3D_OPENGL::generateViasAndPads()
// Subtract the holes
tht_outer_holes_poly.BooleanSubtract( tht_inner_holes_poly, SHAPE_POLY_SET::PM_FAST );
tht_outer_holes_poly.BooleanSubtract( m_antiBoardPolys, SHAPE_POLY_SET::PM_FAST );
if( m_boardAdapter.m_Cfg->m_Render.realistic )
tht_outer_holes_poly.BooleanSubtract( m_antiBoardPolys, SHAPE_POLY_SET::PM_FAST );
CONTAINER_2D holesContainer;
@@ -917,10 +937,6 @@ void RENDER_3D_OPENGL::load3dModels( REPORTER* aStatusReporter )
if( !m_boardAdapter.GetBoard() )
return;
// Building the 3D models late crashes on recent versions of macOS
// Unclear the exact mechanism, but as a workaround, just build them
// all the time. See https://gitlab.com/kicad/code/kicad/-/issues/17198
#ifndef __WXMAC__
if( !m_boardAdapter.m_IsPreviewer
&& !m_boardAdapter.m_Cfg->m_Render.show_footprints_normal
&& !m_boardAdapter.m_Cfg->m_Render.show_footprints_insert
@@ -928,7 +944,6 @@ void RENDER_3D_OPENGL::load3dModels( REPORTER* aStatusReporter )
{
return;
}
#endif
// Go for all footprints
for( const FOOTPRINT* footprint : m_boardAdapter.GetBoard()->Footprints() )
@@ -942,8 +957,8 @@ void RENDER_3D_OPENGL::load3dModels( REPORTER* aStatusReporter )
{
// FindRow() can throw an exception
const FP_LIB_TABLE_ROW* fpRow =
PROJECT_PCB::PcbFootprintLibs( m_boardAdapter.GetBoard()->GetProject() )
->FindRow( libraryName, false );
m_boardAdapter.GetBoard()->GetProject()->PcbFootprintLibs()->FindRow(
libraryName, false );
if( fpRow )
footprintBasePath = fpRow->GetFullURI( true );
@@ -471,11 +471,38 @@ void OPENGL_RENDER_LIST::DrawAll( bool aDrawMiddle ) const
}
void OPENGL_RENDER_LIST::DrawCulled( bool aDrawMiddle,
const OPENGL_RENDER_LIST* aSubtractList,
const OPENGL_RENDER_LIST* bSubtractList,
const OPENGL_RENDER_LIST* cSubtractList,
const OPENGL_RENDER_LIST* dSubtractList ) const
void OPENGL_RENDER_LIST::DrawAllCameraCulled( float zCameraPos, bool aDrawMiddle ) const
{
zCameraPos = m_haveTransformation
? ( ( zCameraPos - m_zPositionTransformation ) / m_zScaleTransformation )
: zCameraPos;
if( aDrawMiddle )
DrawMiddle();
if( zCameraPos > m_zTop )
{
DrawTop();
}
else
{
if( zCameraPos < m_zBot )
{
DrawBot();
}
else
{
// If camera is in the middle dont draw it.
}
}
}
void OPENGL_RENDER_LIST::DrawAllCameraCulledSubtractLayer( bool aDrawMiddle,
const OPENGL_RENDER_LIST* aLayerToSubtractA,
const OPENGL_RENDER_LIST* aLayerToSubtractB,
const OPENGL_RENDER_LIST* aLayerToSubtractC,
const OPENGL_RENDER_LIST* aLayerToSubtractD ) const
{
glClearStencil( 0x00 );
glClear( GL_STENCIL_BUFFER_BIT );
@@ -490,17 +517,17 @@ void OPENGL_RENDER_LIST::DrawCulled( bool aDrawMiddle,
glStencilFunc( GL_ALWAYS, 1, 0 );
glStencilOp( GL_KEEP, GL_KEEP, GL_REPLACE );
if( aSubtractList )
aSubtractList->DrawBot();
if( aLayerToSubtractA )
aLayerToSubtractA->DrawBot();
if( bSubtractList )
bSubtractList->DrawBot();
if( aLayerToSubtractB )
aLayerToSubtractB->DrawBot();
if( cSubtractList )
cSubtractList->DrawBot();
if( aLayerToSubtractC )
aLayerToSubtractC->DrawBot();
if( dSubtractList )
dSubtractList->DrawBot();
if( aLayerToSubtractD )
aLayerToSubtractD->DrawBot();
glEnable(GL_DEPTH_TEST);
glDepthMask(GL_TRUE);
@@ -517,17 +544,17 @@ void OPENGL_RENDER_LIST::DrawCulled( bool aDrawMiddle,
glStencilFunc( GL_ALWAYS, 2, 0 );
glStencilOp( GL_KEEP, GL_KEEP, GL_REPLACE );
if( aSubtractList )
aSubtractList->DrawTop();
if( aLayerToSubtractA )
aLayerToSubtractA->DrawTop();
if( bSubtractList )
bSubtractList->DrawTop();
if( aLayerToSubtractB )
aLayerToSubtractB->DrawTop();
if( cSubtractList )
cSubtractList->DrawTop();
if( aLayerToSubtractC )
aLayerToSubtractC->DrawTop();
if( dSubtractList )
dSubtractList->DrawTop();
if( aLayerToSubtractD )
aLayerToSubtractD->DrawTop();
glEnable(GL_DEPTH_TEST);
glDepthMask(GL_TRUE);
@@ -548,8 +575,8 @@ void OPENGL_RENDER_LIST::DrawCulled( bool aDrawMiddle,
if( aDrawMiddle )
{
if( aSubtractList )
aSubtractList->DrawMiddle();
if( aLayerToSubtractA )
aLayerToSubtractA->DrawMiddle();
}
glLightModeli( GL_LIGHT_MODEL_TWO_SIDE, GL_FALSE );
@@ -561,7 +588,7 @@ void OPENGL_RENDER_LIST::DrawCulled( bool aDrawMiddle,
void OPENGL_RENDER_LIST::ApplyScalePosition( float aZposition, float aZscale )
{
wxCHECK2( aZscale > FLT_EPSILON, aZscale = FLT_EPSILON + 1 );
wxASSERT( aZscale > FLT_EPSILON );
m_zPositionTransformation = aZposition;
m_zScaleTransformation = aZscale;
@@ -569,12 +596,6 @@ void OPENGL_RENDER_LIST::ApplyScalePosition( float aZposition, float aZscale )
}
void OPENGL_RENDER_LIST::ApplyScalePosition( OPENGL_RENDER_LIST* aOtherList )
{
ApplyScalePosition( aOtherList->GetZBot(), aOtherList->GetZTop() - aOtherList->GetZBot() );
}
void OPENGL_RENDER_LIST::SetItIsTransparent( bool aSetTransparent )
{
m_draw_it_transparent = aSetTransparent;
@@ -194,14 +194,15 @@ public:
*
* @param zCameraPos is the camera z axis position.
*/
void DrawCulled( bool aDrawMiddle,
const OPENGL_RENDER_LIST* aSubtractList = nullptr,
const OPENGL_RENDER_LIST* bSubtractList = nullptr,
const OPENGL_RENDER_LIST* cSubtractList = nullptr,
const OPENGL_RENDER_LIST* dSubtractList = nullptr ) const;
void DrawAllCameraCulled( float zCameraPos, bool aDrawMiddle = true ) const;
void DrawAllCameraCulledSubtractLayer( bool aDrawMiddle,
const OPENGL_RENDER_LIST* aLayerToSubtractA = nullptr,
const OPENGL_RENDER_LIST* aLayerToSubtractB = nullptr,
const OPENGL_RENDER_LIST* aLayerToSubtractC = nullptr,
const OPENGL_RENDER_LIST* aLayerToSubtractD = nullptr ) const;
void ApplyScalePosition( float aZposition, float aZscale );
void ApplyScalePosition( OPENGL_RENDER_LIST* aOtherList );
void ClearScalePosition() { m_haveTransformation = false; }
@@ -27,7 +27,7 @@
#include <trigo.h>
#include <wx/debug.h> // For the wxASSERT
#define RADPERDEG 0.0174533f
#define RADPERDEG 0.0174533
void DrawRoundArrow( SFVEC3F aPosition, SFVEC3F aTargetPos, float aSize )
{
@@ -155,7 +155,7 @@ void DrawHalfOpenCylinder( unsigned int aNrSidesPerCircle )
{
SFVEC2D corner = SFVEC2D( 0.0, radius );
RotatePoint( &corner.x, &corner.y, ii );
glVertex3f( static_cast<GLfloat>( corner.x ), static_cast<GLfloat>( corner.y ), 0.0 );
glVertex3f( corner.x, corner.y, 0.0 );
}
glVertex3d( 0.0, -radius, 0.0 );
@@ -171,7 +171,7 @@ void DrawHalfOpenCylinder( unsigned int aNrSidesPerCircle )
SFVEC2D corner = SFVEC2D( 0.0, radius );
RotatePoint( &corner.x, &corner.y, ii );
glVertex3f( static_cast<GLfloat>( corner.x ), static_cast<GLfloat>( corner.y ), 1.0 );
glVertex3f( corner.x, corner.y, 1.0 );
}
glVertex3f( 0.0, radius, 1.0 );
@@ -185,10 +185,9 @@ void DrawHalfOpenCylinder( unsigned int aNrSidesPerCircle )
SFVEC2D corner = SFVEC2D( 0.0, radius );
RotatePoint( &corner.x, &corner.y, ii );
glNormal3f( static_cast<GLfloat>( corner.x * 2.0f ),
static_cast<GLfloat>( corner.y * 2.0f ), 0.0f );
glVertex3f( static_cast<GLfloat>( corner.x ), static_cast<GLfloat>( corner.y ), 1.0f );
glVertex3f( static_cast<GLfloat>( corner.x ), static_cast<GLfloat>( corner.y ), 0.0f );
glNormal3f( corner.x * 2.0f, corner.y * 2.0f, 0.0f );
glVertex3f( corner.x, corner.y, 1.0 );
glVertex3f( corner.x, corner.y, 0.0 );
}
glNormal3f( 0.0, 1.0f, 0.0f );
File diff suppressed because it is too large Load Diff
@@ -73,15 +73,16 @@ public:
private:
OPENGL_RENDER_LIST* generateHoles( const LIST_OBJECT2D& aListHolesObject2d,
const SHAPE_POLY_SET& aPoly, float aZtop, float aZbot,
bool aInvertFaces,
const SHAPE_POLY_SET& aPoly, float aZtop,
float aZbot, bool aInvertFaces,
const BVH_CONTAINER_2D* aThroughHoles = nullptr );
OPENGL_RENDER_LIST* generateLayerList( const BVH_CONTAINER_2D* aContainer,
const SHAPE_POLY_SET* aPolyList, PCB_LAYER_ID aLayer,
const SHAPE_POLY_SET* aPolyList,
PCB_LAYER_ID aLayerId,
const BVH_CONTAINER_2D* aThroughHoles = nullptr );
OPENGL_RENDER_LIST* generateEmptyLayerList( PCB_LAYER_ID aLayer );
OPENGL_RENDER_LIST* generateEmptyLayerList( PCB_LAYER_ID aLayerId );
void addTopAndBottomTriangles( TRIANGLE_DISPLAY_LIST* aDst, const SFVEC2F& v0,
const SFVEC2F& v1, const SFVEC2F& v2, float top, float bot );
@@ -92,17 +93,17 @@ private:
void addObjectTriangles( const POLYGON_4PT_2D* aPoly, TRIANGLE_DISPLAY_LIST* aDstLayer,
float aZtop, float aZbot );
void addObjectTriangles( const FILLED_CIRCLE_2D* aCircle, TRIANGLE_DISPLAY_LIST* aDstLayer,
float aZtop, float aZbot );
void addObjectTriangles( const FILLED_CIRCLE_2D* aFilledCircle,
TRIANGLE_DISPLAY_LIST* aDstLayer, float aZtop, float aZbot );
void addObjectTriangles( const TRIANGLE_2D* aTri, TRIANGLE_DISPLAY_LIST* aDstLayer,
float aZtop, float aZbot );
void addObjectTriangles( const ROUND_SEGMENT_2D* aSeg, TRIANGLE_DISPLAY_LIST* aDstLayer,
float aZtop, float aZbot );
void addObjectTriangles( const ROUND_SEGMENT_2D* aSeg,
TRIANGLE_DISPLAY_LIST* aDstLayer, float aZtop, float aZbot );
void renderSolderMaskLayer( PCB_LAYER_ID aLayerID, float aZPos, bool aShowThickness,
bool aSkipRenderHoles );
void renderSolderMaskLayer( PCB_LAYER_ID aLayerID, float aZPosition,
bool aDrawMiddleSegments, bool aSkipRenderHoles );
void renderBoardBody( bool aSkipRenderHoles );
@@ -153,12 +154,15 @@ private:
void renderOpaqueModels( const glm::mat4 &aCameraViewMatrix );
void renderTransparentModels( const glm::mat4 &aCameraViewMatrix );
void renderModel( const glm::mat4 &aCameraViewMatrix, const MODELTORENDER &aModelToRender,
const SFVEC3F &aSelColor, const SFVEC3F *aCameraWorldPos );
void renderModel( const glm::mat4 &aCameraViewMatrix,
const MODELTORENDER &aModelToRender,
const SFVEC3F &aSelColor,
const SFVEC3F *aCameraWorldPos );
void get3dModelsSelected( std::list<MODELTORENDER> &aDstRenderList, bool aGetTop, bool aGetBot,
bool aRenderTransparentOnly, bool aRenderSelectedOnly );
void get3dModelsSelected( std::list<MODELTORENDER> &aDstRenderList,
bool aGetTop, bool aGetBot, bool aRenderTransparentOnly,
bool aRenderSelectedOnly );
void get3dModelsFromFootprint( std::list<MODELTORENDER> &aDstRenderList,
const FOOTPRINT* aFootprint, bool aRenderTransparentOnly,
@@ -185,6 +189,7 @@ private:
void unsetDepthOffset();
void setLayerMaterial( PCB_LAYER_ID aLayerID );
SFVEC4F getLayerColor( PCB_LAYER_ID aLayerID );
bool initializeOpenGL();
OPENGL_RENDER_LIST* createBoard( const SHAPE_POLY_SET& aBoardPoly,
@@ -211,8 +216,6 @@ private:
MAP_OGL_DISP_LISTS m_layers;
OPENGL_RENDER_LIST* m_platedPadsFront;
OPENGL_RENDER_LIST* m_platedPadsBack;
OPENGL_RENDER_LIST* m_offboardPadsFront;
OPENGL_RENDER_LIST* m_offboardPadsBack;
MAP_OGL_DISP_LISTS m_outerLayerHoles;
MAP_OGL_DISP_LISTS m_innerLayerHoles;
OPENGL_RENDER_LIST* m_board;
@@ -232,8 +235,8 @@ private:
OPENGL_RENDER_LIST* m_padHoles;
// Caches
std::map<wxString, MODEL_3D*> m_3dModelMap;
std::map<std::vector<float>, glm::mat4> m_3dModelMatrixMap;
std::map< wxString, MODEL_3D* > m_3dModelMap;
std::map< std::vector<float>, glm::mat4 > m_3dModelMatrixMap;
BOARD_ITEM* m_currentRollOverItem;
+1 -1
View File
@@ -30,7 +30,7 @@
#ifndef POST_SHADER_H
#define POST_SHADER_H
#include <gal/3d/camera.h>
#include "camera.h"
class POST_SHADER
{
@@ -23,7 +23,7 @@
*/
/**
* @file bvh_pbrt.cpp
* @file cbvh_pbrt.cpp
* @brief This BVH implementation is based on the source code implementation
* from the book "Physically Based Rendering" (v2 and v3)
*
@@ -437,7 +437,7 @@ BVHBuildNode *BVH_PBRT::recursiveBuild ( std::vector<BVHPrimitiveInfo>& primitiv
(*totalNodes)++;
// !TODO: implement a memory arena
// !TODO: implement an memory Arena
BVHBuildNode *node = static_cast<BVHBuildNode *>( malloc( sizeof( BVHBuildNode ) ) );
m_nodesToFree.push_back( node );
@@ -2,8 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2015-2022 Mario Luzeiro <mrluzeiro@ua.pt>
* Copyright (C) 2023 CERN
* Copyright (C) 2015-2023 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2015-2022 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -42,10 +41,9 @@
#include <footprint.h>
#include <fp_lib_table.h>
#include <eda_3d_viewer_frame.h>
#include <project_pcb.h>
#include <base_units.h>
#include <core/profile.h> // To use GetRunningMicroSecs or another profiling utility
#include <profile.h> // To use GetRunningMicroSecs or another profiling utility
/**
* Perform an interpolation step to easy control the transparency based on the
@@ -236,9 +234,7 @@ void RENDER_3D_RAYTRACE::createItemsFromContainer( const BVH_CONTAINER_2D* aCont
if( aContainer2d == nullptr )
return;
EDA_3D_VIEWER_SETTINGS::RENDER_SETTINGS& cfg = m_boardAdapter.m_Cfg->m_Render;
bool isSilk = aLayer_id == B_SilkS || aLayer_id == F_SilkS;
const LIST_OBJECT2D& listObject2d = aContainer2d->GetList();
const LIST_OBJECT2D& listObject2d = aContainer2d->GetList();
if( listObject2d.size() == 0 )
return;
@@ -277,8 +273,11 @@ void RENDER_3D_RAYTRACE::createItemsFromContainer( const BVH_CONTAINER_2D* aCont
// layer and the flag is set, then clip the silk at the outer edge of the annular ring,
// rather than the at the outer edge of the copper plating.
const BVH_CONTAINER_2D& throughHoleOuter =
cfg.clip_silk_on_via_annuli && isSilk ? m_boardAdapter.GetViaAnnuli()
: m_boardAdapter.GetTH_ODs();
m_boardAdapter.m_Cfg->m_Render.clip_silk_on_via_annulus
&& m_boardAdapter.m_Cfg->m_Render.realistic
&& ( aLayer_id == B_SilkS || aLayer_id == F_SilkS ) ?
m_boardAdapter.GetThroughHoleAnnularRings() :
m_boardAdapter.GetThroughHoleOds();
if( !throughHoleOuter.GetList().empty() )
{
@@ -304,13 +303,14 @@ void RENDER_3D_RAYTRACE::createItemsFromContainer( const BVH_CONTAINER_2D* aCont
const MAP_CONTAINER_2D_BASE& mapLayers = m_boardAdapter.GetLayerMap();
if( cfg.subtract_mask_from_silk
if( m_boardAdapter.m_Cfg->m_Render.subtract_mask_from_silk
&& m_boardAdapter.m_Cfg->m_Render.realistic
&& ( ( aLayer_id == B_SilkS && mapLayers.find( B_Mask ) != mapLayers.end() )
|| ( aLayer_id == F_SilkS && mapLayers.find( F_Mask ) != mapLayers.end() ) ) )
{
const PCB_LAYER_ID maskLayer = ( aLayer_id == B_SilkS ) ? B_Mask : F_Mask;
const PCB_LAYER_ID layerMask_id = ( aLayer_id == B_SilkS ) ? B_Mask : F_Mask;
const BVH_CONTAINER_2D* containerMaskLayer2d = mapLayers.at( maskLayer );
const BVH_CONTAINER_2D* containerMaskLayer2d = mapLayers.at( layerMask_id );
CONST_LIST_OBJECT2D intersecting;
@@ -330,8 +330,8 @@ void RENDER_3D_RAYTRACE::createItemsFromContainer( const BVH_CONTAINER_2D* aCont
if( ( object2d_B == CSGITEM_EMPTY ) && ( object2d_C == CSGITEM_FULL ) )
{
LAYER_ITEM* objPtr = new LAYER_ITEM( object2d_A,
m_boardAdapter.GetLayerBottomZPos( aLayer_id ) - aLayerZOffset,
m_boardAdapter.GetLayerTopZPos( aLayer_id ) + aLayerZOffset );
m_boardAdapter.GetLayerBottomZPos( aLayer_id ) - aLayerZOffset,
m_boardAdapter.GetLayerTopZPos( aLayer_id ) + aLayerZOffset );
objPtr->SetMaterial( aMaterialLayer );
objPtr->SetColor( ConvertSRGBToLinear( aLayerColor ) );
m_objectContainer.Add( objPtr );
@@ -343,8 +343,8 @@ void RENDER_3D_RAYTRACE::createItemsFromContainer( const BVH_CONTAINER_2D* aCont
m_containerWithObjectsToDelete.Add( itemCSG2d );
LAYER_ITEM* objPtr = new LAYER_ITEM( itemCSG2d,
m_boardAdapter.GetLayerBottomZPos( aLayer_id ) - aLayerZOffset,
m_boardAdapter.GetLayerTopZPos( aLayer_id ) + aLayerZOffset );
m_boardAdapter.GetLayerBottomZPos( aLayer_id ) - aLayerZOffset,
m_boardAdapter.GetLayerTopZPos( aLayer_id ) + aLayerZOffset );
objPtr->SetMaterial( aMaterialLayer );
objPtr->SetColor( ConvertSRGBToLinear( aLayerColor ) );
@@ -368,7 +368,7 @@ void RENDER_3D_RAYTRACE::Reload( REPORTER* aStatusReporter, REPORTER* aWarningRe
OBJECT_2D_STATS::Instance().ResetStats();
OBJECT_3D_STATS::Instance().ResetStats();
int64_t stats_startReloadTime = GetRunningMicroSecs();
unsigned stats_startReloadTime = GetRunningMicroSecs();
if( !aOnlyLoadCopperAndShapes )
{
@@ -393,8 +393,6 @@ void RENDER_3D_RAYTRACE::Reload( REPORTER* aStatusReporter, REPORTER* aWarningRe
m_outlineBoard2dObjects = new CONTAINER_2D;
m_antioutlineBoard2dObjects = new BVH_CONTAINER_2D;
std::bitset<LAYER_3D_END> layerFlags = m_boardAdapter.GetVisibleLayers();
if( !aOnlyLoadCopperAndShapes )
{
const int outlineCount = m_boardAdapter.GetBoardPoly().OutlineCount();
@@ -436,7 +434,7 @@ void RENDER_3D_RAYTRACE::Reload( REPORTER* aStatusReporter, REPORTER* aWarningRe
*m_boardAdapter.GetBoard(), ii );
}
if( layerFlags.test( LAYER_3D_BOARD ) )
if( m_boardAdapter.m_Cfg->m_Render.show_board_body )
{
const LIST_OBJECT2D& listObjects = m_outlineBoard2dObjects->GetList();
@@ -445,9 +443,9 @@ void RENDER_3D_RAYTRACE::Reload( REPORTER* aStatusReporter, REPORTER* aWarningRe
std::vector<const OBJECT_2D*>* object2d_B = new std::vector<const OBJECT_2D*>();
// Check if there are any THT that intersects this outline object part
if( !m_boardAdapter.GetTH_ODs().GetList().empty() )
if( !m_boardAdapter.GetThroughHoleOds().GetList().empty() )
{
const BVH_CONTAINER_2D& throughHoles = m_boardAdapter.GetTH_ODs();
const BVH_CONTAINER_2D& throughHoles = m_boardAdapter.GetThroughHoleOds();
CONST_LIST_OBJECT2D intersecting;
throughHoles.GetIntersectingObjects( object2d_A->GetBBox(), intersecting );
@@ -511,9 +509,9 @@ void RENDER_3D_RAYTRACE::Reload( REPORTER* aStatusReporter, REPORTER* aWarningRe
// a polygon or dummy block) it will cut also the render of the hole.
// So this will add a full hole.
// In fact, that is not need if the hole have copper.
if( !m_boardAdapter.GetTH_ODs().GetList().empty() )
if( !m_boardAdapter.GetThroughHoleOds().GetList().empty() )
{
const LIST_OBJECT2D& holeList = m_boardAdapter.GetTH_ODs().GetList();
const LIST_OBJECT2D& holeList = m_boardAdapter.GetThroughHoleOds().GetList();
for( const OBJECT_2D* hole2d : holeList )
{
@@ -588,33 +586,40 @@ void RENDER_3D_RAYTRACE::Reload( REPORTER* aStatusReporter, REPORTER* aWarningRe
case B_Paste:
case F_Paste:
materialLayer = &m_materials.m_Paste;
layerColor = m_boardAdapter.m_SolderPasteColor;
if( m_boardAdapter.m_Cfg->m_Render.realistic )
layerColor = m_boardAdapter.m_SolderPasteColor;
else
layerColor = m_boardAdapter.GetLayerColor( layer_id );
break;
case B_SilkS:
materialLayer = &m_materials.m_SilkS;
layerColor = m_boardAdapter.m_SilkScreenColorBot;
if( m_boardAdapter.m_Cfg->m_Render.realistic )
layerColor = m_boardAdapter.m_SilkScreenColorBot;
else
layerColor = m_boardAdapter.GetLayerColor( layer_id );
break;
case F_SilkS:
materialLayer = &m_materials.m_SilkS;
layerColor = m_boardAdapter.m_SilkScreenColorTop;
if( m_boardAdapter.m_Cfg->m_Render.realistic )
layerColor = m_boardAdapter.m_SilkScreenColorTop;
else
layerColor = m_boardAdapter.GetLayerColor( layer_id );
break;
case Dwgs_User:
layerColor = m_boardAdapter.m_UserDrawingsColor;
break;
case Cmts_User:
layerColor = m_boardAdapter.m_UserCommentsColor;
break;
case Eco1_User:
layerColor = m_boardAdapter.m_ECO1Color;
break;
case Eco2_User:
layerColor = m_boardAdapter.m_ECO2Color;
case Edge_Cuts:
case Margin:
break;
case B_CrtYd:
@@ -626,15 +631,22 @@ void RENDER_3D_RAYTRACE::Reload( REPORTER* aStatusReporter, REPORTER* aWarningRe
break;
default:
if( m_boardAdapter.m_Cfg->m_Render.differentiate_plated_copper )
if( m_boardAdapter.m_Cfg->m_Render.realistic )
{
layerColor = SFVEC3F( 184.0f / 255.0f, 115.0f / 255.0f, 50.0f / 255.0f );
materialLayer = &m_materials.m_NonPlatedCopper;
if( m_boardAdapter.m_Cfg->m_Render.renderPlatedPadsAsPlated )
{
layerColor = SFVEC3F( 184.0f / 255.0f, 115.0f / 255.0f, 50.0f / 255.0f );
materialLayer = &m_materials.m_NonPlatedCopper;
}
else
{
layerColor = m_boardAdapter.m_CopperColor;
materialLayer = &m_materials.m_Copper;
}
}
else
{
layerColor = m_boardAdapter.m_CopperColor;
materialLayer = &m_materials.m_Copper;
layerColor = m_boardAdapter.GetLayerColor( layer_id );
}
break;
@@ -644,7 +656,8 @@ void RENDER_3D_RAYTRACE::Reload( REPORTER* aStatusReporter, REPORTER* aWarningRe
} // for each layer on map
// Create plated copper
if( m_boardAdapter.m_Cfg->m_Render.differentiate_plated_copper )
if( m_boardAdapter.m_Cfg->m_Render.renderPlatedPadsAsPlated
&& m_boardAdapter.m_Cfg->m_Render.realistic )
{
createItemsFromContainer( m_boardAdapter.GetPlatedPadsFront(), F_Cu, &m_materials.m_Copper,
m_boardAdapter.m_CopperColor,
@@ -661,9 +674,8 @@ void RENDER_3D_RAYTRACE::Reload( REPORTER* aStatusReporter, REPORTER* aWarningRe
// Solder mask layers are "negative" layers so the elements that we have in the container
// should remove the board outline. We will check for all objects in the outline if it
// intersects any object in the layer container and also any hole.
if( ( layerFlags.test( LAYER_3D_SOLDERMASK_TOP )
|| layerFlags.test( LAYER_3D_SOLDERMASK_BOTTOM ) )
&& !m_outlineBoard2dObjects->GetList().empty() )
if( m_boardAdapter.m_Cfg->m_Render.show_soldermask
&& !m_outlineBoard2dObjects->GetList().empty() )
{
const MATERIAL* materialLayer = &m_materials.m_SolderMask;
@@ -677,22 +689,22 @@ void RENDER_3D_RAYTRACE::Reload( REPORTER* aStatusReporter, REPORTER* aWarningRe
continue;
// Only get the Solder mask layers (and only if the board has them)
if( layer_id == F_Mask && !layerFlags.test( LAYER_3D_SOLDERMASK_TOP ) )
continue;
if( layer_id == B_Mask && !layerFlags.test( LAYER_3D_SOLDERMASK_BOTTOM ) )
continue;
// Only Mask layers are processed here because they are negative layers
if( layer_id != F_Mask && layer_id != B_Mask )
if( !( layer_id == B_Mask || layer_id == F_Mask ) )
continue;
SFVEC3F layerColor;
if( layer_id == B_Mask )
layerColor = m_boardAdapter.m_SolderMaskColorBot;
if( m_boardAdapter.m_Cfg->m_Render.realistic )
{
if( layer_id == B_Mask )
layerColor = m_boardAdapter.m_SolderMaskColorBot;
else
layerColor = m_boardAdapter.m_SolderMaskColorTop;
}
else
layerColor = m_boardAdapter.m_SolderMaskColorTop;
{
layerColor = m_boardAdapter.GetLayerColor( layer_id );
}
const float zLayerMin = m_boardAdapter.GetLayerBottomZPos( layer_id );
const float zLayerMax = m_boardAdapter.GetLayerTopZPos( layer_id );
@@ -703,9 +715,9 @@ void RENDER_3D_RAYTRACE::Reload( REPORTER* aStatusReporter, REPORTER* aWarningRe
std::vector<const OBJECT_2D*>* object2d_B = new std::vector<const OBJECT_2D*>();
// Check if there are any THT that intersects this outline object part
if( !m_boardAdapter.GetTH_ODs().GetList().empty() )
if( !m_boardAdapter.GetThroughHoleOds().GetList().empty() )
{
const BVH_CONTAINER_2D& throughHoles = m_boardAdapter.GetTH_ODs();
const BVH_CONTAINER_2D& throughHoles = m_boardAdapter.GetThroughHoleOds();
CONST_LIST_OBJECT2D intersecting;
throughHoles.GetIntersectingObjects( object2d_A->GetBBox(), intersecting );
@@ -771,8 +783,8 @@ void RENDER_3D_RAYTRACE::Reload( REPORTER* aStatusReporter, REPORTER* aWarningRe
}
#ifdef PRINT_STATISTICS_3D_VIEWER
int64_t stats_endConvertTime = GetRunningMicroSecs();
int64_t stats_startLoad3DmodelsTime = stats_endConvertTime;
unsigned stats_endConvertTime = GetRunningMicroSecs();
unsigned stats_startLoad3DmodelsTime = stats_endConvertTime;
#endif
if( aStatusReporter )
@@ -781,7 +793,7 @@ void RENDER_3D_RAYTRACE::Reload( REPORTER* aStatusReporter, REPORTER* aWarningRe
load3DModels( m_objectContainer, aOnlyLoadCopperAndShapes );
#ifdef PRINT_STATISTICS_3D_VIEWER
int64_t stats_endLoad3DmodelsTime = GetRunningMicroSecs();
unsigned stats_endLoad3DmodelsTime = GetRunningMicroSecs();
#endif
if( !aOnlyLoadCopperAndShapes )
@@ -955,7 +967,7 @@ void RENDER_3D_RAYTRACE::Reload( REPORTER* aStatusReporter, REPORTER* aWarningRe
if( aStatusReporter )
{
// Calculation time in seconds
double calculation_time = (double) ( GetRunningMicroSecs() - stats_startReloadTime ) / 1e6;
double calculation_time = (double) GetRunningMicroSecs() - stats_startReloadTime / 1e6;
aStatusReporter->Report( wxString::Format( _( "Reload time %.3f s" ), calculation_time ) );
}
@@ -987,7 +999,15 @@ void RENDER_3D_RAYTRACE::insertHole( const PCB_VIA* aVia )
LAYER_ITEM* objPtr = new LAYER_ITEM( ring, topZ, botZ );
objPtr->SetMaterial( &m_materials.m_Copper );
objPtr->SetColor( ConvertSRGBToLinear( m_boardAdapter.m_CopperColor ) );
if( m_boardAdapter.m_Cfg->m_Render.realistic )
objPtr->SetColor( ConvertSRGBToLinear( m_boardAdapter.m_CopperColor ) );
else if( aVia->GetViaType() == VIATYPE::MICROVIA )
objPtr->SetColor( ConvertSRGBToLinear( m_boardAdapter.GetItemColor( LAYER_VIA_MICROVIA ) ) );
else if( aVia->GetViaType() == VIATYPE::BLIND_BURIED )
objPtr->SetColor( ConvertSRGBToLinear( m_boardAdapter.GetItemColor( LAYER_VIA_BBLIND ) ) );
else
objPtr->SetColor( ConvertSRGBToLinear( m_boardAdapter.GetItemColor( LAYER_VIAS ) ) );
m_objectContainer.Add( objPtr );
}
@@ -997,7 +1017,13 @@ void RENDER_3D_RAYTRACE::insertHole( const PAD* aPad )
{
const OBJECT_2D* object2d_A = nullptr;
SFVEC3F objColor = m_boardAdapter.m_CopperColor;
SFVEC3F objColor;
if( m_boardAdapter.m_Cfg->m_Render.realistic )
objColor = m_boardAdapter.m_CopperColor;
else
objColor = m_boardAdapter.GetItemColor( LAYER_PADS_TH );
const VECTOR2I drillsize = aPad->GetDrillSize();
const bool hasHole = drillsize.x && drillsize.y;
@@ -1116,11 +1142,12 @@ void RENDER_3D_RAYTRACE::insertHole( const PAD* aPad )
// Check if there are any other THT that intersects this hole
// It will use the non inflated holes
if( !m_boardAdapter.GetTH_IDs().GetList().empty() )
if( !m_boardAdapter.GetThroughHoleIds().GetList().empty() )
{
CONST_LIST_OBJECT2D intersecting;
m_boardAdapter.GetTH_IDs().GetIntersectingObjects( object2d_A->GetBBox(), intersecting );
m_boardAdapter.GetThroughHoleIds().GetIntersectingObjects( object2d_A->GetBBox(),
intersecting );
for( const OBJECT_2D* hole2d : intersecting )
{
@@ -1259,8 +1286,8 @@ void RENDER_3D_RAYTRACE::load3DModels( CONTAINER_3D& aDstContainer, bool aSkipMa
{
// FindRow() can throw an exception
const FP_LIB_TABLE_ROW* fpRow =
PROJECT_PCB::PcbFootprintLibs( m_boardAdapter.GetBoard()->GetProject() )
->FindRow( libraryName, false );
m_boardAdapter.GetBoard()->GetProject()->PcbFootprintLibs()->FindRow(
libraryName, false );
if( fpRow )
footprintBasePath = fpRow->GetFullURI( true );
+2 -3
View File
@@ -141,8 +141,8 @@ struct RAYSEG2D
bool IntersectSegment( const SFVEC2F &aStartA, const SFVEC2F &aEnd_minus_startA,
const SFVEC2F &aStartB, const SFVEC2F &aEnd_minus_startB );
/*
#if(GLM_ARCH != GLM_ARCH_PURE)
/*
struct RAY4
{
glm::simdVec4 m_orgX; ///< x coordinate of ray origin
@@ -155,10 +155,9 @@ struct RAY4
glm::simdVec4 m_tnear; ///< Start of ray segment
glm::simdVec4 m_tfar; ///< End of ray segment
};
};*/
#endif
*/
#endif // RAY_H
@@ -27,7 +27,7 @@
#include "ray.h"
#include "frustum.h"
#include <gal/3d/camera.h>
#include "../camera.h"
#define RAYPACKET_DIM (1 << 3)
#define RAYPACKET_MASK (unsigned int) ( ( RAYPACKET_DIM - 1 ) )
@@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2015-2020 Mario Luzeiro <mrluzeiro@ua.pt>
* Copyright (C) 2015-2023 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2015-2021 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -27,6 +27,7 @@
#include <algorithm>
#include <atomic>
#include <chrono>
#include <climits>
#include <thread>
#include "render_3d_raytrace.h"
@@ -35,7 +36,7 @@
#include "3d_fastmath.h"
#include "3d_math.h"
#include "../common_ogl/ogl_utils.h"
#include <core/profile.h> // To use GetRunningMicroSecs or another profiling utility
#include <profile.h> // To use GetRunningMicroSecs or another profiling utility
#include <wx/log.h>
@@ -91,7 +92,7 @@ RENDER_3D_RAYTRACE::~RENDER_3D_RAYTRACE()
int RENDER_3D_RAYTRACE::GetWaitForEditingTimeOut()
{
return 200; // ms
return 1000; // ms
}
@@ -154,7 +154,7 @@ private:
RT_RENDER_STATE m_renderState;
/// Time that the render starts
int64_t m_renderStartTime;
unsigned long int m_renderStartTime;
/// Save the number of blocks progress of the render
size_t m_blockRenderProgressCount;
@@ -31,7 +31,6 @@
#include "object_2d.h"
#include "../ray.h"
#include "filled_circle_2d.h"
#include <plugins/3dapi/xv3d_types.h> // SFVEC2F
class BOARD_ITEM;
@@ -23,7 +23,8 @@
*/
/**
* @file cylinder_3d.cpp
* @file ccylinder.cpp
* @brief
*/
#include "3d_fastmath.h"
@@ -23,7 +23,8 @@
*/
/**
* @file object_3d.cpp
* @file cobject.cpp
* @brief
*/
#include "object_3d.h"
@@ -52,7 +52,7 @@ class OBJECT_3D
public:
explicit OBJECT_3D( OBJECT_3D_TYPE aObjType );
void SetBoardItem( BOARD_ITEM* aBoardItem ) { m_boardItem = aBoardItem; }
const void SetBoardItem( BOARD_ITEM* aBoardItem ) { m_boardItem = aBoardItem; }
BOARD_ITEM* GetBoardItem() const { return m_boardItem; }
void SetMaterial( const MATERIAL* aMaterial )
+1 -1
View File
@@ -23,7 +23,7 @@
*/
/**
* @file track_ball.cpp
* @file ctrack_ball.cpp
* @brief Implementation of a track ball camera. A track ball is placed in the
* center of the screen and rotates the camera.
*/
+1 -1
View File
@@ -30,7 +30,7 @@
#ifndef TRACK_BALL_H
#define TRACK_BALL_H
#include <gal/3d/camera.h>
#include "camera.h"
class TRACK_BALL : public CAMERA
+30 -24
View File
@@ -4,8 +4,7 @@
* Copyright (C) 2016 Mario Luzeiro <mrluzeiro@ua.pt>
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2013 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 2023 CERN
* Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -28,6 +27,7 @@
#include <bitmaps.h>
#include <tool/conditional_menu.h>
#include <eda_3d_viewer_frame.h>
#include <menus_helpers.h>
#include <3d_viewer_id.h>
#include <3d_viewer/tools/eda_3d_actions.h>
#include <tool/tool_manager.h>
@@ -35,12 +35,11 @@
#include <widgets/wx_menubar.h>
void EDA_3D_VIEWER_FRAME::doReCreateMenuBar()
void EDA_3D_VIEWER_FRAME::CreateMenuBar()
{
wxLogTrace( m_logTrace, wxT( "EDA_3D_VIEWER_FRAME::CreateMenuBar" ) );
COMMON_CONTROL* tool = m_toolManager->GetTool<COMMON_CONTROL>();
wxMenuBar* oldMenuBar = GetMenuBar();
WX_MENUBAR* menuBar = new WX_MENUBAR();
@@ -82,20 +81,6 @@ void EDA_3D_VIEWER_FRAME::doReCreateMenuBar()
viewMenu->Add( ACTIONS::zoomFitScreen );
viewMenu->Add( ACTIONS::zoomRedraw );
// Grid submenu
ACTION_MENU* gridSubmenu = new ACTION_MENU( false, tool );
gridSubmenu->SetTitle( _( "3D Grid" ) );
gridSubmenu->SetIcon( BITMAPS::grid );
gridSubmenu->Add( EDA_3D_ACTIONS::noGrid, ACTION_MENU::CHECK);
gridSubmenu->Add( EDA_3D_ACTIONS::show10mmGrid, ACTION_MENU::CHECK);
gridSubmenu->Add( EDA_3D_ACTIONS::show5mmGrid, ACTION_MENU::CHECK);
gridSubmenu->Add( EDA_3D_ACTIONS::show2_5mmGrid, ACTION_MENU::CHECK);
gridSubmenu->Add( EDA_3D_ACTIONS::show1mmGrid, ACTION_MENU::CHECK);
viewMenu->AppendSeparator();
viewMenu->Add( gridSubmenu );
viewMenu->AppendSeparator();
viewMenu->Add( EDA_3D_ACTIONS::rotateXCW );
viewMenu->Add( EDA_3D_ACTIONS::rotateXCCW );
@@ -114,9 +99,6 @@ void EDA_3D_VIEWER_FRAME::doReCreateMenuBar()
viewMenu->Add( EDA_3D_ACTIONS::moveUp );
viewMenu->Add( EDA_3D_ACTIONS::moveDown );
viewMenu->AppendSeparator();
viewMenu->Add( EDA_3D_ACTIONS::showLayersManager, ACTION_MENU::CHECK );
//-- Preferences menu -----------------------------------------------
//
@@ -127,12 +109,37 @@ void EDA_3D_VIEWER_FRAME::doReCreateMenuBar()
BITMAPS::tools,
ACTION_MENU::CHECK );
prefsMenu->Add( ACTIONS::openPreferences );
prefsMenu->Add( _( "Preferences..." ) + wxT( "\tCtrl+," ),
_( "Show preferences for all open tools" ),
wxID_PREFERENCES,
BITMAPS::preference );
prefsMenu->Add( _( "Reset to Default Settings" ), ID_MENU3D_RESET_DEFAULTS, BITMAPS::tools );
prefsMenu->AppendSeparator();
AddMenuLanguageList( prefsMenu, tool );
prefsMenu->Add( EDA_3D_ACTIONS::showTHT, ACTION_MENU::CHECK );
prefsMenu->Add( EDA_3D_ACTIONS::showSMD, ACTION_MENU::CHECK );
prefsMenu->Add( EDA_3D_ACTIONS::showVirtual, ACTION_MENU::CHECK );
prefsMenu->Add( EDA_3D_ACTIONS::showNotInPosFile, ACTION_MENU::CHECK );
prefsMenu->AppendSeparator();
prefsMenu->Add( EDA_3D_ACTIONS::showAxis, ACTION_MENU::CHECK );
prefsMenu->Add( EDA_3D_ACTIONS::showBBoxes, ACTION_MENU::CHECK );
// Grid submenu
ACTION_MENU* gridSubmenu = new ACTION_MENU( false, tool );
gridSubmenu->SetTitle( _( "3D Grid" ) );
gridSubmenu->SetIcon( BITMAPS::grid );
gridSubmenu->Add( EDA_3D_ACTIONS::noGrid, ACTION_MENU::CHECK);
gridSubmenu->Add( EDA_3D_ACTIONS::show10mmGrid, ACTION_MENU::CHECK);
gridSubmenu->Add( EDA_3D_ACTIONS::show5mmGrid, ACTION_MENU::CHECK);
gridSubmenu->Add( EDA_3D_ACTIONS::show2_5mmGrid, ACTION_MENU::CHECK);
gridSubmenu->Add( EDA_3D_ACTIONS::show1mmGrid, ACTION_MENU::CHECK);
prefsMenu->Add( gridSubmenu );
//-- Menubar -------------------------------------------------------------
//
@@ -143,5 +150,4 @@ void EDA_3D_VIEWER_FRAME::doReCreateMenuBar()
AddStandardHelpMenu( menuBar );
SetMenuBar( menuBar );
delete oldMenuBar;
}
+36 -3
View File
@@ -4,8 +4,7 @@
* Copyright (C) 2016 Mario Luzeiro <mrluzeiro@ua.pt>
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2013 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 2023 CERN
* Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -31,6 +30,7 @@
#include <bitmaps.h>
#include <dialogs/eda_view_switcher.h>
#include <eda_3d_viewer_frame.h>
#include <menus_helpers.h>
#include <tool/action_toolbar.h>
#include <tools/eda_3d_actions.h>
#include <3d_viewer_id.h>
@@ -52,6 +52,32 @@ void EDA_3D_VIEWER_FRAME::ReCreateMainToolbar()
m_mainToolBar->SetAuiManager( &m_auimgr );
}
// Show the hotkey to open the windows list selector:
wxString keyName = KeyNameFromKeyCode( VIEWPORT_SWITCH_KEY );
m_viewportsLabel = new wxStaticText( m_mainToolBar, wxID_ANY,
wxString::Format( _( "Viewports (%s+Tab):" ), keyName ) );
m_viewportsLabel->Wrap( -1 );
m_cbViewports = new wxChoice( m_mainToolBar, wxID_ANY );
for( std::pair<const wxString, VIEWPORT3D>& pair : m_viewports )
m_cbViewports->Append( pair.first, static_cast<void*>( &pair.second ) );
m_cbViewports->Append( wxT( "---" ) );
m_cbViewports->Append( _( "Save viewport..." ) );
m_cbViewports->Append( _( "Delete viewport..." ) );
m_cbViewports->SetToolTip( wxString::Format( _( "Save and restore view orientation and zoom.\n"
"Use %s+Tab to activate selector.\n"
"Successive Tabs while holding %s down will "
"cycle through viewports in the popup." ),
keyName, keyName ) );
m_cbViewports->SetSelection( m_cbViewports->GetCount() - 3 );
m_lastSelectedViewport = nullptr;
// Set up toolbar
m_mainToolBar->AddTool( ID_RELOAD3D_BOARD, wxEmptyString,
KiScaledBitmap( BITMAPS::import3d, this ), _( "Reload board" ) );
@@ -97,7 +123,14 @@ void EDA_3D_VIEWER_FRAME::ReCreateMainToolbar()
m_mainToolBar->Add( EDA_3D_ACTIONS::toggleOrtho, ACTION_TOOLBAR::TOGGLE );
m_mainToolBar->AddScaledSeparator( this );
m_mainToolBar->Add( EDA_3D_ACTIONS::showLayersManager, ACTION_TOOLBAR::TOGGLE );
m_mainToolBar->Add( EDA_3D_ACTIONS::showTHT, ACTION_TOOLBAR::TOGGLE );
m_mainToolBar->Add( EDA_3D_ACTIONS::showSMD, ACTION_TOOLBAR::TOGGLE );
m_mainToolBar->Add( EDA_3D_ACTIONS::showVirtual, ACTION_TOOLBAR::TOGGLE );
m_mainToolBar->Add( EDA_3D_ACTIONS::showNotInPosFile, ACTION_TOOLBAR::TOGGLE );
m_mainToolBar->AddScaledSeparator( this );
m_mainToolBar->AddControl( m_viewportsLabel );
m_mainToolBar->AddControl( m_cbViewports );
m_mainToolBar->KiRealize();
}
+254 -229
View File
@@ -2,8 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
* Copyright (C) 2023 CERN
* Copyright (C) 1992-2024 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -29,9 +28,11 @@
#include <wx/wupdlock.h>
#include <wx/clipbrd.h>
#include <wx/filedlg.h>
#include <wx/choice.h>
#include <wx/dialog.h>
#include "eda_3d_viewer_frame.h"
#include "dialogs/appearance_controls_3D.h"
#include "eda_list_dialog.h"
#include "wx/generic/textdlgg.h"
#include <dialogs/eda_view_switcher.h>
#include <eda_3d_viewer_settings.h>
#include <3d_viewer_id.h>
@@ -42,7 +43,7 @@
#include <bitmaps.h>
#include <board_design_settings.h>
#include <core/arraydim.h>
#include <dpi_scaling_common.h>
#include <gal/dpi_scaling.h>
#include <pgm_base.h>
#include <project.h>
#include <project/project_file.h>
@@ -54,9 +55,7 @@
#include <tool/tool_dispatcher.h>
#include <tool/action_toolbar.h>
#include <widgets/wx_infobar.h>
#include <widgets/wx_aui_utils.h>
#include <wildcards_and_files_ext.h>
#include <project_pcb.h>
#include <3d_navlib/nl_3d_viewer_plugin.h>
@@ -90,11 +89,10 @@ EDA_3D_VIEWER_FRAME::EDA_3D_VIEWER_FRAME( KIWAY* aKiway, PCB_BASE_FRAME* aParent
const wxString& aTitle, long style ) :
KIWAY_PLAYER( aKiway, aParent, FRAME_PCB_DISPLAY3D, aTitle, wxDefaultPosition,
wxDefaultSize, style, QUALIFIED_VIEWER3D_FRAMENAME( aParent ), unityScale ),
m_mainToolBar( nullptr ),
m_canvas( nullptr ),
m_currentCamera( m_trackBallCamera ),
m_trackBallCamera( 2 * RANGE_SCALE_3D ),
m_spaceMouse( nullptr )
m_mainToolBar( nullptr ), m_canvas( nullptr ), m_currentCamera( m_trackBallCamera ),
m_viewportsLabel( nullptr ),
m_cbViewports( nullptr ),
m_trackBallCamera( 2 * RANGE_SCALE_3D ), m_spaceMouse( nullptr )
{
wxLogTrace( m_logTrace, wxT( "EDA_3D_VIEWER_FRAME::EDA_3D_VIEWER_FRAME %s" ), aTitle );
@@ -107,7 +105,7 @@ EDA_3D_VIEWER_FRAME::EDA_3D_VIEWER_FRAME( KIWAY* aKiway, PCB_BASE_FRAME* aParent
SetIcon( icon );
// Create the status line
static const int status_dims[5] = { -1, 170, 130, 130, 130 };
static const int status_dims[4] = { -1, 170, 130, 130 };
wxStatusBar *status_bar = CreateStatusBar( arrayDim( status_dims ) );
SetStatusWidths( arrayDim( status_dims ), status_dims );
@@ -116,16 +114,13 @@ EDA_3D_VIEWER_FRAME::EDA_3D_VIEWER_FRAME( KIWAY* aKiway, PCB_BASE_FRAME* aParent
EDA_3D_VIEWER_SETTINGS* cfg = mgr.GetAppSettings<EDA_3D_VIEWER_SETTINGS>();
ANTIALIASING_MODE aaMode = static_cast<ANTIALIASING_MODE>( cfg->m_Render.opengl_AA_mode );
m_canvas = new EDA_3D_CANVAS( this, OGL_ATT_LIST::GetAttributesList( aaMode ), m_boardAdapter,
m_currentCamera,
PROJECT_PCB::Get3DCacheManager( &Prj() ) );
m_appearancePanel = new APPEARANCE_CONTROLS_3D( this, GetCanvas() );
m_canvas = new EDA_3D_CANVAS( this, OGL_ATT_LIST::GetAttributesList( aaMode ),
m_boardAdapter, m_currentCamera, Prj().Get3DCacheManager() );
LoadSettings( cfg );
loadCommonSettings();
m_appearancePanel->SetUserViewports( Prj().GetProjectFile().m_Viewports3D );
SetUserViewports( Prj().GetProjectFile().m_Viewports3D );
// Create the manager
m_toolManager = new TOOL_MANAGER;
@@ -148,30 +143,16 @@ EDA_3D_VIEWER_FRAME::EDA_3D_VIEWER_FRAME( KIWAY* aKiway, PCB_BASE_FRAME* aParent
// Run the viewer control tool, it is supposed to be always active
m_toolManager->InvokeTool( "3DViewer.Control" );
ReCreateMenuBar();
CreateMenuBar();
ReCreateMainToolbar();
m_infoBar = new WX_INFOBAR( this, &m_auimgr );
m_auimgr.SetManagedWindow( this );
m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( wxS( "MainToolbar" ) )
.Top().Layer( 6 ) );
m_auimgr.AddPane( m_infoBar, EDA_PANE().InfoBar().Name( wxS( "InfoBar" ) )
.Top().Layer( 1 ) );
m_auimgr.AddPane( m_appearancePanel, EDA_PANE().Name( "LayersManager" )
.Right().Layer( 3 )
.Caption( _( "Appearance" ) ).PaneBorder( false )
.MinSize( 180, -1 ).BestSize( 190, -1 ) );
m_auimgr.AddPane( m_canvas, EDA_PANE().Canvas().Name( wxS( "DrawFrame" ) )
.Center() );
wxAuiPaneInfo& layersManager = m_auimgr.GetPane( "LayersManager" );
if( cfg->m_AuiPanels.right_panel_width > 0 )
SetAuiPaneSize( m_auimgr, layersManager, cfg->m_AuiPanels.right_panel_width, -1 );
layersManager.Show( cfg->m_AuiPanels.show_layer_manager );
m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( wxS( "MainToolbar" ) ).Top().Layer( 6 ) );
m_auimgr.AddPane( m_infoBar, EDA_PANE().InfoBar().Name( wxS( "InfoBar" ) ).Top().Layer( 1 ) );
m_auimgr.AddPane( m_canvas, EDA_PANE().Canvas().Name( wxS( "DrawFrame" ) ).Center() );
// Call Update() to fix all pane default sizes, especially the "InfoBar" pane before
// hiding it.
@@ -184,19 +165,30 @@ EDA_3D_VIEWER_FRAME::EDA_3D_VIEWER_FRAME( KIWAY* aKiway, PCB_BASE_FRAME* aParent
m_canvas->SetInfoBar( m_infoBar );
m_canvas->SetStatusBar( status_bar );
try
if( ADVANCED_CFG::GetCfg().m_Use3DConnexionDriver )
{
m_spaceMouse = new NL_3D_VIEWER_PLUGIN( m_canvas );
}
catch( const std::system_error& e )
{
wxLogTrace( wxT( "KI_TRACE_NAVLIB" ), e.what() );
try
{
m_spaceMouse = new NL_3D_VIEWER_PLUGIN( m_canvas );
}
catch( const std::system_error& e )
{
wxLogTrace( wxT( "KI_TRACE_NAVLIB" ), e.what() );
}
}
// Fixes bug in Windows (XP and possibly others) where the canvas requires the focus
// in order to receive mouse events. Otherwise, the user has to click somewhere on
// the canvas before it will respond to mouse wheel events.
m_canvas->SetFocus();
m_cbViewports->Connect( wxEVT_COMMAND_CHOICE_SELECTED,
wxCommandEventHandler( EDA_3D_VIEWER_FRAME::onViewportChanged ),
nullptr, this );
m_cbViewports->Connect( wxEVT_UPDATE_UI,
wxUpdateUIEventHandler( EDA_3D_VIEWER_FRAME::onUpdateViewportsCb ),
nullptr, this );
}
@@ -204,7 +196,14 @@ EDA_3D_VIEWER_FRAME::~EDA_3D_VIEWER_FRAME()
{
delete m_spaceMouse;
Prj().GetProjectFile().m_Viewports3D = m_appearancePanel->GetUserViewports();
Prj().GetProjectFile().m_Viewports3D = GetUserViewports();
m_cbViewports->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED,
wxCommandEventHandler( EDA_3D_VIEWER_FRAME::onViewportChanged ),
nullptr, this );
m_cbViewports->Disconnect( wxEVT_UPDATE_UI,
wxUpdateUIEventHandler( EDA_3D_VIEWER_FRAME::onUpdateViewportsCb ),
nullptr, this );
m_canvas->SetEventDispatcher( nullptr );
@@ -247,15 +246,10 @@ void EDA_3D_VIEWER_FRAME::setupUIConditions()
{
return m_boardAdapter.m_Cfg->m_Render.show_footprints_not_in_posfile;
};
auto show_DNP =
[this]( const SELECTION& aSel )
{
return m_boardAdapter.m_Cfg->m_Render.show_footprints_dnp;
};
auto showBBoxes =
[this]( const SELECTION& aSel )
{
return m_boardAdapter.m_Cfg->m_Render.show_model_bbox;
return m_boardAdapter.m_Cfg->m_Render.opengl_show_model_bbox;
};
auto showAxes =
[this]( const SELECTION& aSel )
@@ -268,31 +262,23 @@ void EDA_3D_VIEWER_FRAME::setupUIConditions()
return m_currentCamera.GetProjection() == PROJECTION_TYPE::ORTHO;
};
auto appearances =
[this]( const SELECTION& aSel )
{
return m_boardAdapter.m_Cfg->m_AuiPanels.show_layer_manager;
};
RegisterUIUpdateHandler( ID_RENDER_CURRENT_VIEW, ACTION_CONDITIONS().Check( raytracing ) );
RegisterUIUpdateHandler( ID_RENDER_CURRENT_VIEW, ACTION_CONDITIONS().Check( raytracing ) );
mgr->SetConditions( EDA_3D_ACTIONS::showTHT, ACTION_CONDITIONS().Check( showTH ) );
mgr->SetConditions( EDA_3D_ACTIONS::showSMD, ACTION_CONDITIONS().Check( showSMD ) );
mgr->SetConditions( EDA_3D_ACTIONS::showVirtual, ACTION_CONDITIONS().Check( showVirtual ) );
mgr->SetConditions( EDA_3D_ACTIONS::showNotInPosFile, ACTION_CONDITIONS().Check( show_NotInPosfile ) );
mgr->SetConditions( EDA_3D_ACTIONS::showTHT, ACTION_CONDITIONS().Check( showTH ) );
mgr->SetConditions( EDA_3D_ACTIONS::showSMD, ACTION_CONDITIONS().Check( showSMD ) );
mgr->SetConditions( EDA_3D_ACTIONS::showVirtual, ACTION_CONDITIONS().Check( showVirtual ) );
mgr->SetConditions( EDA_3D_ACTIONS::showNotInPosFile, ACTION_CONDITIONS().Check( show_NotInPosfile ) );
mgr->SetConditions( EDA_3D_ACTIONS::showDNP, ACTION_CONDITIONS().Check( show_DNP ) );
mgr->SetConditions( EDA_3D_ACTIONS::showBBoxes, ACTION_CONDITIONS().Check( showBBoxes ) );
mgr->SetConditions( EDA_3D_ACTIONS::showAxis, ACTION_CONDITIONS().Check( showAxes ) );
mgr->SetConditions( EDA_3D_ACTIONS::showBBoxes, ACTION_CONDITIONS().Check( showBBoxes ) );
mgr->SetConditions( EDA_3D_ACTIONS::showAxis, ACTION_CONDITIONS().Check( showAxes ) );
mgr->SetConditions( EDA_3D_ACTIONS::noGrid, GridSizeCheck( GRID3D_TYPE::NONE ) );
mgr->SetConditions( EDA_3D_ACTIONS::show10mmGrid, GridSizeCheck( GRID3D_TYPE::GRID_10MM ) );
mgr->SetConditions( EDA_3D_ACTIONS::show5mmGrid, GridSizeCheck( GRID3D_TYPE::GRID_5MM ) );
mgr->SetConditions( EDA_3D_ACTIONS::show2_5mmGrid, GridSizeCheck( GRID3D_TYPE::GRID_2P5MM ) );
mgr->SetConditions( EDA_3D_ACTIONS::show1mmGrid, GridSizeCheck( GRID3D_TYPE::GRID_1MM ) );
mgr->SetConditions( EDA_3D_ACTIONS::toggleOrtho, ACTION_CONDITIONS().Check( ortho ) );
mgr->SetConditions( EDA_3D_ACTIONS::showLayersManager, ACTION_CONDITIONS().Check( appearances ) );
mgr->SetConditions( EDA_3D_ACTIONS::noGrid, GridSizeCheck( GRID3D_TYPE::NONE ) );
mgr->SetConditions( EDA_3D_ACTIONS::show10mmGrid, GridSizeCheck( GRID3D_TYPE::GRID_10MM ) );
mgr->SetConditions( EDA_3D_ACTIONS::show5mmGrid, GridSizeCheck( GRID3D_TYPE::GRID_5MM ) );
mgr->SetConditions( EDA_3D_ACTIONS::show2_5mmGrid, GridSizeCheck( GRID3D_TYPE::GRID_2P5MM ) );
mgr->SetConditions( EDA_3D_ACTIONS::show1mmGrid, GridSizeCheck( GRID3D_TYPE::GRID_1MM ) );
mgr->SetConditions( EDA_3D_ACTIONS::toggleOrtho, ACTION_CONDITIONS().Check( ortho ) );
#undef GridSizeCheck
}
@@ -300,7 +286,6 @@ void EDA_3D_VIEWER_FRAME::setupUIConditions()
bool EDA_3D_VIEWER_FRAME::TryBefore( wxEvent& aEvent )
{
static bool s_presetSwitcherShown = false;
static bool s_viewportSwitcherShown = false;
// wxWidgets generates no key events for the tab key when the ctrl key is held down. One
@@ -314,49 +299,13 @@ bool EDA_3D_VIEWER_FRAME::TryBefore( wxEvent& aEvent )
&& static_cast<wxKeyEvent&>( aEvent ).GetKeyCode() == WXK_TAB )
#endif
{
if( !s_presetSwitcherShown && wxGetKeyState( PRESET_SWITCH_KEY ) )
{
if( m_appearancePanel && this->IsActive() )
{
wxArrayString mru = m_appearancePanel->GetLayerPresetsMRU();
if( mru.size() > 0 )
{
for( wxString& str : mru )
{
if( str == FOLLOW_PCB )
str = _( "Follow PCB Editor" );
else if( str == FOLLOW_PLOT_SETTINGS )
str = _( "Follow PCB Plot Settings" );
}
EDA_VIEW_SWITCHER switcher( this, mru, PRESET_SWITCH_KEY );
s_presetSwitcherShown = true;
switcher.ShowModal();
s_presetSwitcherShown = false;
int idx = switcher.GetSelection();
if( idx >= 0 && idx < (int) mru.size() )
{
wxString internalName = m_appearancePanel->GetLayerPresetsMRU()[idx];
m_appearancePanel->ApplyLayerPreset( internalName );
}
return true;
}
}
}
else if( !s_viewportSwitcherShown && wxGetKeyState( VIEWPORT_SWITCH_KEY ) )
if( !s_viewportSwitcherShown && wxGetKeyState( VIEWPORT_SWITCH_KEY ) )
{
if( this->IsActive() )
{
const wxArrayString& viewportMRU = m_appearancePanel->GetViewportsMRU();
if( viewportMRU.size() > 0 )
if( m_viewportMRU.size() > 0 )
{
EDA_VIEW_SWITCHER switcher( this, viewportMRU, VIEWPORT_SWITCH_KEY );
EDA_VIEW_SWITCHER switcher( this, m_viewportMRU, VIEWPORT_SWITCH_KEY );
s_viewportSwitcherShown = true;
switcher.ShowModal();
@@ -364,8 +313,8 @@ bool EDA_3D_VIEWER_FRAME::TryBefore( wxEvent& aEvent )
int idx = switcher.GetSelection();
if( idx >= 0 && idx < (int) viewportMRU.size() )
m_appearancePanel->ApplyViewport( viewportMRU[idx] );
if( idx >= 0 && idx < (int) m_viewportMRU.size() )
applyViewport( m_viewportMRU[idx] );
return true;
}
@@ -381,31 +330,29 @@ void EDA_3D_VIEWER_FRAME::handleIconizeEvent( wxIconizeEvent& aEvent )
{
KIWAY_PLAYER::handleIconizeEvent( aEvent );
if( m_spaceMouse && aEvent.IsIconized() )
if( m_spaceMouse != nullptr && aEvent.IsIconized()
&& ADVANCED_CFG::GetCfg().m_Use3DConnexionDriver )
{
m_spaceMouse->SetFocus( false );
}
}
void EDA_3D_VIEWER_FRAME::ReloadRequest()
{
// This will schedule a request to load later
// ReloadRequest also updates the board pointer so always call it first
if( m_canvas )
m_canvas->ReloadRequest( GetBoard(), PROJECT_PCB::Get3DCacheManager( &Prj() ) );
if( m_appearancePanel )
m_appearancePanel->UpdateLayerCtls();
m_canvas->ReloadRequest( GetBoard(), Prj().Get3DCacheManager() );
}
void EDA_3D_VIEWER_FRAME::NewDisplay( bool aForceImmediateRedraw )
{
if( m_canvas )
m_canvas->ReloadRequest( GetBoard(), PROJECT_PCB::Get3DCacheManager( &Prj() ) );
ReloadRequest();
// After the ReloadRequest call, the refresh often takes a bit of time,
// and it is made here only on request.
if( m_canvas && aForceImmediateRedraw )
if( aForceImmediateRedraw )
m_canvas->Refresh();
}
@@ -439,11 +386,6 @@ void EDA_3D_VIEWER_FRAME::OnCloseWindow( wxCloseEvent &event )
{
wxLogTrace( m_logTrace, wxT( "EDA_3D_VIEWER_FRAME::OnCloseWindow" ) );
// Do not show the layer manager during closing to avoid flicker on some platforms (Windows)
// that generate useless redraw of items in the Layer Manager
if( m_auimgr.GetPane( wxS( "LayersManager" ) ).IsShown() )
m_auimgr.GetPane( wxS( "LayersManager" ) ).Show( false );
if( m_canvas )
m_canvas->Close();
@@ -497,6 +439,174 @@ void EDA_3D_VIEWER_FRAME::Process_Special_Functions( wxCommandEvent &event )
}
std::vector<VIEWPORT3D> EDA_3D_VIEWER_FRAME::GetUserViewports() const
{
std::vector<VIEWPORT3D> ret;
for( const std::pair<const wxString, VIEWPORT3D>& pair : m_viewports )
ret.emplace_back( pair.second );
return ret;
}
void EDA_3D_VIEWER_FRAME::SetUserViewports( std::vector<VIEWPORT3D>& aViewportList )
{
m_viewports.clear();
for( const VIEWPORT3D& viewport : aViewportList )
{
if( m_viewports.count( viewport.name ) )
continue;
m_viewports[viewport.name] = viewport;
m_viewportMRU.Add( viewport.name );
}
}
void EDA_3D_VIEWER_FRAME::applyViewport( const wxString& aViewportName )
{
int idx = m_cbViewports->FindString( aViewportName );
if( idx >= 0 && idx < m_cbViewports->GetCount() - 3 /* separator */ )
{
m_cbViewports->SetSelection( idx );
m_lastSelectedViewport = static_cast<VIEWPORT3D*>( m_cbViewports->GetClientData( idx ) );
m_currentCamera.SetViewMatrix( m_lastSelectedViewport->matrix );
if( m_boardAdapter.m_Cfg->m_Render.engine == RENDER_ENGINE::OPENGL )
m_canvas->Request_refresh();
else
m_canvas->RenderRaytracingRequest();
if( !m_lastSelectedViewport->name.IsEmpty() )
{
m_viewportMRU.Remove( m_lastSelectedViewport->name );
m_viewportMRU.Insert( m_lastSelectedViewport->name, 0 );
}
}
else
{
m_cbViewports->SetSelection( -1 ); // separator
m_lastSelectedViewport = nullptr;
}
}
void EDA_3D_VIEWER_FRAME::onViewportChanged( wxCommandEvent& aEvent )
{
int count = m_cbViewports->GetCount();
int index = m_cbViewports->GetSelection();
if( index >= 0 && index < count - 3 /* separator */ )
{
VIEWPORT3D* viewport = static_cast<VIEWPORT3D*>( m_cbViewports->GetClientData( index ) );
wxCHECK( viewport, /* void */ );
applyViewport( viewport->name );
}
else if( index == count - 2 )
{
// Save current state to new preset
wxString name;
wxTextEntryDialog dlg( this, _( "Viewport name:" ), _( "Save Viewport" ), name );
if( dlg.ShowModal() != wxID_OK )
{
if( m_lastSelectedViewport )
m_cbViewports->SetStringSelection( m_lastSelectedViewport->name );
else
m_cbViewports->SetSelection( -1 );
return;
}
name = dlg.GetValue();
bool exists = m_viewports.count( name );
if( !exists )
{
m_viewports[name] = VIEWPORT3D( name, m_currentCamera.GetViewMatrix() );
index = m_cbViewports->Insert( name, index-1, static_cast<void*>( &m_viewports[name] ) );
}
else
{
index = m_cbViewports->FindString( name );
m_viewports[name].matrix = m_currentCamera.GetViewMatrix();
m_viewportMRU.Remove( name );
}
m_cbViewports->SetSelection( index );
m_viewportMRU.Insert( name, 0 );
return;
}
else if( index == count - 1 )
{
// Delete an existing viewport
wxArrayString headers;
std::vector<wxArrayString> items;
headers.Add( _( "Viewports" ) );
for( std::pair<const wxString, VIEWPORT3D>& pair : m_viewports )
{
wxArrayString item;
item.Add( pair.first );
items.emplace_back( item );
}
EDA_LIST_DIALOG dlg( this, _( "Delete Viewport" ), headers, items );
dlg.SetListLabel( _( "Select viewport:" ) );
if( dlg.ShowModal() == wxID_OK )
{
wxString viewportName = dlg.GetTextSelection();
int idx = m_cbViewports->FindString( viewportName );
if( idx != wxNOT_FOUND )
{
m_viewports.erase( viewportName );
m_cbViewports->Delete( idx );
m_viewportMRU.Remove( viewportName );
}
}
if( m_lastSelectedViewport )
m_cbViewports->SetStringSelection( m_lastSelectedViewport->name );
else
m_cbViewports->SetSelection( -1 );
return;
}
passOnFocus();
}
void EDA_3D_VIEWER_FRAME::onUpdateViewportsCb( wxUpdateUIEvent& aEvent )
{
int count = m_cbViewports->GetCount();
int index = m_cbViewports->GetSelection();
if( index >= 0 && index < count - 3 )
{
VIEWPORT3D* viewport = static_cast<VIEWPORT3D*>( m_cbViewports->GetClientData( index ) );
wxCHECK( viewport, /* void */ );
if( m_currentCamera.GetViewMatrix() != viewport->matrix )
m_cbViewports->SetSelection( -1 );
}
}
void EDA_3D_VIEWER_FRAME::onRenderEngineSelection( wxCommandEvent &event )
{
RENDER_ENGINE& engine = m_boardAdapter.m_Cfg->m_Render.engine;
@@ -540,7 +650,7 @@ void EDA_3D_VIEWER_FRAME::OnActivate( wxActivateEvent &aEvent )
m_canvas->SetFocus();
}
if( m_spaceMouse )
if( m_spaceMouse != nullptr && ADVANCED_CFG::GetCfg().m_Use3DConnexionDriver )
m_spaceMouse->SetFocus( aEvent.GetActive() );
aEvent.Skip(); // required under wxMAC
@@ -557,6 +667,13 @@ void EDA_3D_VIEWER_FRAME::OnSetFocus( wxFocusEvent& aEvent )
}
void EDA_3D_VIEWER_FRAME::passOnFocus()
{
if( m_canvas )
m_canvas->SetFocus();
}
void EDA_3D_VIEWER_FRAME::LoadSettings( APP_SETTINGS_BASE *aCfg )
{
EDA_BASE_FRAME::LoadSettings( aCfg );
@@ -568,35 +685,16 @@ void EDA_3D_VIEWER_FRAME::LoadSettings( APP_SETTINGS_BASE *aCfg )
if( cfg )
{
applySettings( cfg );
m_boardAdapter.SetBoard( GetBoard() );
m_boardAdapter.m_Cfg = cfg;
// When opening the 3D viewer, we use the OpenGL mode, never the ray tracing engine
// because the ray tracing is very time consuming, and can be seen as not working
// (freeze window) with large boards.
m_boardAdapter.m_Cfg->m_Render.engine = RENDER_ENGINE::OPENGL;
if( cfg->m_CurrentPreset == LEGACY_PRESET_FLAG )
{
wxString legacyColorsPresetName = _( "legacy colors" );
cfg->m_UseStackupColors = false;
if( !cfg->FindPreset( legacyColorsPresetName ) )
{
cfg->m_LayerPresets.emplace_back( legacyColorsPresetName,
GetAdapter().GetDefaultVisibleLayers(),
GetAdapter().GetDefaultColors() );
}
cfg->m_CurrentPreset = wxEmptyString;
}
m_boardAdapter.InitSettings( nullptr, nullptr );
if( m_appearancePanel )
m_appearancePanel->CommonSettingsChanged();
m_canvas->SetAnimationEnabled( cfg->m_Camera.animation_enabled );
m_canvas->SetMovingSpeedMultiplier( cfg->m_Camera.moving_speed_multiplier );
m_canvas->SetProjectionMode( cfg->m_Camera.projection_mode );
}
}
@@ -616,8 +714,6 @@ void EDA_3D_VIEWER_FRAME::SaveSettings( APP_SETTINGS_BASE *aCfg )
if( cfg )
{
cfg->m_AuiPanels.right_panel_width = m_appearancePanel->GetSize().x;
cfg->m_Camera.animation_enabled = m_canvas->GetAnimationEnabled();
cfg->m_Camera.moving_speed_multiplier = m_canvas->GetMovingSpeedMultiplier();
cfg->m_Camera.projection_mode = m_canvas->GetProjectionMode();
@@ -639,64 +735,12 @@ void EDA_3D_VIEWER_FRAME::CommonSettingsChanged( bool aEnvVarsChanged, bool aTex
ReCreateMainToolbar();
loadCommonSettings();
applySettings( Pgm().GetSettingsManager().GetAppSettings<EDA_3D_VIEWER_SETTINGS>() );
m_appearancePanel->CommonSettingsChanged();
LoadSettings( Pgm().GetSettingsManager().GetAppSettings<EDA_3D_VIEWER_SETTINGS>() );
NewDisplay( true );
}
void EDA_3D_VIEWER_FRAME::ShowChangedLanguage()
{
EDA_BASE_FRAME::ShowChangedLanguage();
SetTitle( _( "3D Viewer" ) );
ReCreateMainToolbar();
if( m_appearancePanel )
{
wxAuiPaneInfo& lm_pane_info = m_auimgr.GetPane( m_appearancePanel );
lm_pane_info.Caption( _( "Appearance" ) );
m_appearancePanel->OnLanguageChanged();
}
SetStatusText( wxEmptyString, ACTIVITY );
SetStatusText( wxEmptyString, HOVERED_ITEM );
}
void EDA_3D_VIEWER_FRAME::ToggleAppearanceManager()
{
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EDA_3D_VIEWER_SETTINGS* cfg = mgr.GetAppSettings<EDA_3D_VIEWER_SETTINGS>();
wxAuiPaneInfo& layersManager = m_auimgr.GetPane( "LayersManager" );
// show auxiliary Vertical layers and visibility manager toolbar
cfg->m_AuiPanels.show_layer_manager = !cfg->m_AuiPanels.show_layer_manager;
layersManager.Show( cfg->m_AuiPanels.show_layer_manager );
if( cfg->m_AuiPanels.show_layer_manager )
{
SetAuiPaneSize( m_auimgr, layersManager, cfg->m_AuiPanels.right_panel_width, -1 );
}
else
{
cfg->m_AuiPanels.right_panel_width = m_appearancePanel->GetSize().x;
m_auimgr.Update();
}
}
void EDA_3D_VIEWER_FRAME::OnDarkModeToggle()
{
if( m_appearancePanel )
m_appearancePanel->OnDarkModeToggle();
}
void EDA_3D_VIEWER_FRAME::takeScreenshot( wxCommandEvent& event )
{
wxString fullFileName;
@@ -708,8 +752,8 @@ void EDA_3D_VIEWER_FRAME::takeScreenshot( wxCommandEvent& event )
if( event.GetId() != ID_TOOL_SCREENCOPY_TOCLIBBOARD )
{
// Remember path between saves during this session only.
const wxString wildcard = fmt_is_jpeg ? FILEEXT::JpegFileWildcard() : FILEEXT::PngFileWildcard();
const wxString ext = fmt_is_jpeg ? FILEEXT::JpegFileExtension : FILEEXT::PngFileExtension;
const wxString wildcard = fmt_is_jpeg ? JpegFileWildcard() : PngFileWildcard();
const wxString ext = fmt_is_jpeg ? JpegFileExtension : PngFileExtension;
// First time path is set to the project path.
if( !m_defaultSaveScreenshotFileName.IsOk() )
@@ -750,13 +794,8 @@ void EDA_3D_VIEWER_FRAME::takeScreenshot( wxCommandEvent& event )
}
// Be sure we have the latest 3D view (remember 3D view is buffered)
// Also ensure any highlighted item is not highlighted when creating screen shot
EDA_3D_VIEWER_SETTINGS::RENDER_SETTINGS& cfg = m_boardAdapter.m_Cfg->m_Render;
bool allow_highlight = cfg.highlight_on_rollover;
cfg.highlight_on_rollover = false;
m_canvas->DoRePaint(); // init first buffer
m_canvas->DoRePaint(); // init second buffer
m_canvas->Request_refresh( true );
wxYield();
// Build image from the 3D buffer
wxWindowUpdateLocker noUpdates( this );
@@ -766,8 +805,6 @@ void EDA_3D_VIEWER_FRAME::takeScreenshot( wxCommandEvent& event )
if( m_canvas )
m_canvas->GetScreenshot( screenshotImage );
cfg.highlight_on_rollover = allow_highlight;
if( event.GetId() == ID_TOOL_SCREENCOPY_TOCLIBBOARD )
{
wxBitmap bitmap( screenshotImage );
@@ -812,21 +849,9 @@ void EDA_3D_VIEWER_FRAME::loadCommonSettings()
COMMON_SETTINGS* settings = Pgm().GetCommonSettings();
const DPI_SCALING_COMMON dpi{ settings, this };
const DPI_SCALING dpi{ settings, this };
m_canvas->SetScaleFactor( dpi.GetScaleFactor() );
// TODO(JE) use all control options
m_boardAdapter.m_MousewheelPanning = settings->m_Input.scroll_modifier_zoom != 0;
}
void EDA_3D_VIEWER_FRAME::applySettings( EDA_3D_VIEWER_SETTINGS* cfg )
{
m_boardAdapter.m_Cfg = cfg;
m_canvas->SetAnimationEnabled( cfg->m_Camera.animation_enabled );
m_canvas->SetMovingSpeedMultiplier( cfg->m_Camera.moving_speed_multiplier );
m_canvas->SetProjectionMode( cfg->m_Camera.projection_mode );
m_canvas->SetVcSettings( EDA_DRAW_PANEL_GAL::GetVcSettings() );
}
+26 -16
View File
@@ -4,8 +4,7 @@
* Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
* Copyright (C) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 2023 CERN
* Copyright (C) 1992-2024 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -26,7 +25,7 @@
*/
/**
* @file eda_3d_viewer_frame.h
* @file eda_3d_viewer.h
* @brief Declaration of the eda_3d_viewer class
*/
@@ -41,12 +40,15 @@
#include <dialogs/dialog_color_picker.h> // for CUSTOM_COLORS_LIST definition
/// A variable name whose value holds the path of 3D shape files.
/// Currently an environment variable, eventually a project variable.
#define KICAD7_3DMODEL_DIR wxT( "KICAD7_3DMODEL_DIR" )
#define KICAD_DEFAULT_3D_DRAWFRAME_STYLE (wxDEFAULT_FRAME_STYLE | wxWANTS_CHARS)
// Forward declarations
class NL_3D_VIEWER_PLUGIN;
class APPEARANCE_CONTROLS_3D;
enum EDA_3D_VIEWER_STATUSBAR
{
@@ -54,7 +56,6 @@ enum EDA_3D_VIEWER_STATUSBAR
HOVERED_ITEM,
X_POS,
Y_POS,
ZOOM_LEVEL,
};
/**
@@ -105,6 +106,9 @@ public:
EDA_3D_CANVAS* GetCanvas() { return m_canvas; }
std::vector<VIEWPORT3D> GetUserViewports() const;
void SetUserViewports( std::vector<VIEWPORT3D>& aViewportList );
void SaveSettings( APP_SETTINGS_BASE* aCfg ) override;
void LoadSettings( APP_SETTINGS_BASE* aCfg ) override;
@@ -115,19 +119,18 @@ public:
* from the PCB frame because the 3D viewer isn't updated via the #KIWAY.
*/
void CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged ) override;
void ShowChangedLanguage() override;
APPEARANCE_CONTROLS_3D* GetAppearanceManager() { return m_appearancePanel; }
void ToggleAppearanceManager();
void OnDarkModeToggle();
protected:
void setupUIConditions() override;
void handleIconizeEvent( wxIconizeEvent& aEvent ) override;
/**
* switch to a given predefined 3D viewport
* @param aViewportName is the name of the viewport to switch on
*/
void applyViewport( const wxString& aViewportName );
private:
/// Called when user press the File->Exit
void Exit3DFrame( wxCommandEvent& event );
@@ -140,11 +143,14 @@ private:
void onRenderEngineSelection( wxCommandEvent& event );
void onDisableRayTracing( wxCommandEvent& aEvent );
void onViewportChanged( wxCommandEvent& aEvent );
void onUpdateViewportsCb( wxUpdateUIEvent& aEvent );
void OnActivate( wxActivateEvent& event );
void OnSetFocus( wxFocusEvent& event );
void passOnFocus();
void doReCreateMenuBar() override;
void CreateMenuBar();
void ReCreateMainToolbar();
/**
@@ -167,12 +173,12 @@ private:
*/
void loadCommonSettings();
void applySettings( EDA_3D_VIEWER_SETTINGS* aSettings );
private:
wxFileName m_defaultSaveScreenshotFileName;
ACTION_TOOLBAR* m_mainToolBar;
wxStaticText* m_viewportsLabel;
wxChoice* m_cbViewports;
EDA_3D_CANVAS* m_canvas;
BOARD_ADAPTER m_boardAdapter;
CAMERA& m_currentCamera;
@@ -182,6 +188,10 @@ private:
NL_3D_VIEWER_PLUGIN* m_spaceMouse;
std::map<wxString, VIEWPORT3D> m_viewports;
VIEWPORT3D* m_lastSelectedViewport;
wxArrayString m_viewportMRU;
/**
* Trace mask used to enable or disable the trace output of this class.
* The debug output can be turned on by setting the WXTRACE environment variable to
+18 -242
View File
@@ -2,8 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2020 Jon Evans <jon@craftyjon.com>
* Copyright (C) 2023 CERN
* Copyright (C) 2020-2023 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2020-2022 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@@ -23,172 +22,21 @@
#include <common_ogl/ogl_attr_list.h>
#include <settings/parameters.h>
#include <settings/json_settings_internals.h>
#include <3d_canvas/board_adapter.h>
#include <wx/config.h>
#include "eda_3d_viewer_settings.h"
using KIGFX::COLOR4D;
using namespace std::placeholders;
LAYER_PRESET_3D::LAYER_PRESET_3D( const wxString& aName ) :
name( aName )
{
layers.set( LAYER_3D_BOARD );
layers.set( LAYER_3D_COPPER_TOP );
layers.set( LAYER_3D_COPPER_BOTTOM );
layers.set( LAYER_3D_SILKSCREEN_TOP );
layers.set( LAYER_3D_SILKSCREEN_BOTTOM );
layers.set( LAYER_3D_SOLDERMASK_TOP );
layers.set( LAYER_3D_SOLDERMASK_BOTTOM );
layers.set( LAYER_3D_SOLDERPASTE );
layers.set( LAYER_3D_ADHESIVE );
layers.set( LAYER_3D_TH_MODELS );
layers.set( LAYER_3D_SMD_MODELS );
layers.set( LAYER_FP_REFERENCES );
layers.set( LAYER_FP_TEXT );
layers.set( LAYER_GRID_AXES );
// Preload colors vector so we don't have to worry about exceptions using colors.at()
colors[ LAYER_3D_BACKGROUND_TOP ] = BOARD_ADAPTER::g_DefaultBackgroundTop;
colors[ LAYER_3D_BACKGROUND_BOTTOM ] = BOARD_ADAPTER::g_DefaultBackgroundBot;
colors[ LAYER_3D_BOARD ] = BOARD_ADAPTER::g_DefaultBoardBody;
colors[ LAYER_3D_COPPER_TOP ] = BOARD_ADAPTER::g_DefaultSurfaceFinish;
colors[ LAYER_3D_COPPER_BOTTOM ] = BOARD_ADAPTER::g_DefaultSurfaceFinish;
colors[ LAYER_3D_SILKSCREEN_TOP ] = BOARD_ADAPTER::g_DefaultSilkscreen;
colors[ LAYER_3D_SILKSCREEN_BOTTOM ] = BOARD_ADAPTER::g_DefaultSilkscreen;
colors[ LAYER_3D_SOLDERMASK_TOP ] = BOARD_ADAPTER::g_DefaultSolderMask;
colors[ LAYER_3D_SOLDERMASK_BOTTOM ] = BOARD_ADAPTER::g_DefaultSolderMask;
colors[ LAYER_3D_SOLDERPASTE ] = BOARD_ADAPTER::g_DefaultSolderPaste;
colors[ LAYER_3D_USER_DRAWINGS ] = BOARD_ADAPTER::g_DefaultComments;
colors[ LAYER_3D_USER_COMMENTS ] = BOARD_ADAPTER::g_DefaultComments;
colors[ LAYER_3D_USER_ECO1 ] = BOARD_ADAPTER::g_DefaultECOs;
colors[ LAYER_3D_USER_ECO2 ] = BOARD_ADAPTER::g_DefaultECOs;
}
PARAM_LAYER_PRESET_3D::PARAM_LAYER_PRESET_3D( const std::string& aPath,
std::vector<LAYER_PRESET_3D>* aPresetList ) :
PARAM_LAMBDA<nlohmann::json>( aPath,
std::bind( &PARAM_LAYER_PRESET_3D::presetsToJson, this ),
std::bind( &PARAM_LAYER_PRESET_3D::jsonToPresets, this, _1 ),
{} ),
m_presets( aPresetList )
{
wxASSERT( aPresetList );
}
nlohmann::json PARAM_LAYER_PRESET_3D::presetsToJson()
{
nlohmann::json ret = nlohmann::json::array();
for( const LAYER_PRESET_3D& preset : *m_presets )
{
nlohmann::json js = {
{ "name", preset.name }
};
nlohmann::json layers = nlohmann::json::array();
for( int layer = 0; layer < LAYER_3D_END; ++layer )
{
if( preset.layers.test( layer ) )
layers.push_back( layer );
}
js["layers"] = layers;
nlohmann::json colors = nlohmann::json::array();
for( const auto& [ layer, color ] : preset.colors )
{
nlohmann::json layerColor = {
{ "layer", layer },
{ "color", color.ToCSSString() }
};
colors.push_back( layerColor );
}
js["colors"] = colors;
ret.push_back( js );
}
return ret;
}
void PARAM_LAYER_PRESET_3D::jsonToPresets( const nlohmann::json& aJson )
{
if( aJson.empty() || !aJson.is_array() )
return;
m_presets->clear();
for( const nlohmann::json& preset : aJson )
{
if( preset.contains( "name" ) )
{
LAYER_PRESET_3D p( preset.at( "name" ).get<wxString>() );
if( preset.contains( "layers" ) && preset.at( "layers" ).is_array() )
{
p.layers.reset();
for( const nlohmann::json& layer : preset.at( "layers" ) )
{
if( layer.is_number_integer() )
{
int layerNum = layer.get<int>();
if( layerNum >= 0 && layerNum < LAYER_3D_END )
p.layers.set( layerNum );
}
}
}
if( preset.contains( "colors" ) && preset.at( "colors" ).is_array() )
{
for( const nlohmann::json& layerColor : preset.at( "colors" ) )
{
if( layerColor.contains( "layer" ) && layerColor.contains( "color" )
&& layerColor.at( "layer" ).is_number_integer() )
{
int layerNum = layerColor.at( "layer" ).get<int>();
COLOR4D color = layerColor.at( "color" ).get<COLOR4D>();
p.colors[ layerNum ] = color;
}
}
}
m_presets->emplace_back( p );
}
}
}
///! Update the schema version whenever a migration is required
const int viewer3dSchemaVersion = 3;
const int viewer3dSchemaVersion = 2;
EDA_3D_VIEWER_SETTINGS::EDA_3D_VIEWER_SETTINGS() :
APP_SETTINGS_BASE( "3d_viewer", viewer3dSchemaVersion ),
m_Render(),
m_Camera()
EDA_3D_VIEWER_SETTINGS::EDA_3D_VIEWER_SETTINGS()
: APP_SETTINGS_BASE( "3d_viewer", viewer3dSchemaVersion ),
m_Render(),
m_Camera()
{
m_params.emplace_back( new PARAM<bool>( "aui.show_layer_manager",
&m_AuiPanels.show_layer_manager, true ) );
m_params.emplace_back( new PARAM<int>( "aui.right_panel_width",
&m_AuiPanels.right_panel_width, -1 ) );
m_params.emplace_back( new PARAM_ENUM<RENDER_ENGINE>( "render.engine", &m_Render.engine,
RENDER_ENGINE::OPENGL,
RENDER_ENGINE::OPENGL,
@@ -219,11 +67,9 @@ EDA_3D_VIEWER_SETTINGS::EDA_3D_VIEWER_SETTINGS() :
m_params.emplace_back( new PARAM<bool>( "render.opengl_copper_thickness",
&m_Render.opengl_copper_thickness, false ) );
m_params.emplace_back( new PARAM<bool>( "render.opengl_show_model_bbox",
&m_Render.show_model_bbox, false ) );
m_params.emplace_back( new PARAM<bool>( "render.opengl_show_off_board_silk",
&m_Render.show_off_board_silk, false ) );
&m_Render.opengl_show_model_bbox, false ) );
m_params.emplace_back( new PARAM<bool>( "render.opengl_highlight_on_rollover",
&m_Render.highlight_on_rollover, true ) );
&m_Render.opengl_highlight_on_rollover, true ) );
m_params.emplace_back( new PARAM<bool>( "render.opengl_AA_disableOnMove",
&m_Render.opengl_AA_disableOnMove, false ) );
m_params.emplace_back( new PARAM<bool>( "render.opengl_thickness_disableOnMove",
@@ -316,6 +162,8 @@ EDA_3D_VIEWER_SETTINGS::EDA_3D_VIEWER_SETTINGS() :
&m_Render.raytrace_lightAzimuth,
default_azimuth ) );
m_params.emplace_back( new PARAM<bool>( "render.realistic",
&m_Render.realistic, true ) );
m_params.emplace_back( new PARAM<bool>( "render.show_adhesive",
&m_Render.show_adhesive, true ) );
m_params.emplace_back( new PARAM<bool>( "render.show_axis",
@@ -324,12 +172,8 @@ EDA_3D_VIEWER_SETTINGS::EDA_3D_VIEWER_SETTINGS() :
&m_Render.show_board_body, true ) );
m_params.emplace_back( new PARAM<bool>( "render.show_comments",
&m_Render.show_comments, true ) );
m_params.emplace_back( new PARAM<bool>( "render.show_drawings",
&m_Render.show_drawings, true ) );
m_params.emplace_back( new PARAM<bool>( "render.show_eco1",
&m_Render.show_eco1, true ) );
m_params.emplace_back( new PARAM<bool>( "render.show_eco2",
&m_Render.show_eco2, true ) );
m_params.emplace_back( new PARAM<bool>( "render.show_eco",
&m_Render.show_eco, true ) );
m_params.emplace_back( new PARAM<bool>( "render.show_footprints_insert",
&m_Render.show_footprints_insert, true ) );
m_params.emplace_back( new PARAM<bool>( "render.show_footprints_normal",
@@ -338,36 +182,20 @@ EDA_3D_VIEWER_SETTINGS::EDA_3D_VIEWER_SETTINGS() :
&m_Render.show_footprints_virtual, true ) );
m_params.emplace_back( new PARAM<bool>( "render.show_footprints_not_in_posfile",
&m_Render.show_footprints_not_in_posfile, true ) );
m_params.emplace_back( new PARAM<bool>( "render.show_footprints_dnp",
&m_Render.show_footprints_dnp, false ) );
m_params.emplace_back( new PARAM<bool>( "render.show_silkscreen_top",
&m_Render.show_silkscreen_top, true ) );
m_params.emplace_back( new PARAM<bool>( "render.show_silkscreen_bottom",
&m_Render.show_silkscreen_bottom, true ) );
m_params.emplace_back( new PARAM<bool>( "render.show_soldermask_top",
&m_Render.show_soldermask_top, true ) );
m_params.emplace_back( new PARAM<bool>( "render.show_soldermask_bottom",
&m_Render.show_soldermask_bottom, true ) );
m_params.emplace_back( new PARAM<bool>( "render.show_silkscreen",
&m_Render.show_silkscreen, true ) );
m_params.emplace_back( new PARAM<bool>( "render.show_soldermask",
&m_Render.show_soldermask, true ) );
m_params.emplace_back( new PARAM<bool>( "render.show_solderpaste",
&m_Render.show_solderpaste, true ) );
m_params.emplace_back( new PARAM<bool>( "render.show_copper_top",
&m_Render.show_copper_bottom, true ) );
m_params.emplace_back( new PARAM<bool>( "render.show_copper_bottom",
&m_Render.show_copper_top, true ) );
m_params.emplace_back( new PARAM<bool>( "render.show_zones",
&m_Render.show_zones, true ) );
m_params.emplace_back( new PARAM<bool>( "render.show_fp_references",
&m_Render.show_fp_references, true ) );
m_params.emplace_back( new PARAM<bool>( "render.show_fp_values",
&m_Render.show_fp_values, true ) );
m_params.emplace_back( new PARAM<bool>( "render.show_fp_text",
&m_Render.show_fp_text, true ) );
m_params.emplace_back( new PARAM<bool>( "render.subtract_mask_from_silk",
&m_Render.subtract_mask_from_silk, false ) );
m_params.emplace_back( new PARAM<bool>( "render.clip_silk_on_via_annulus",
&m_Render.clip_silk_on_via_annuli, false ) );
&m_Render.clip_silk_on_via_annulus, false ) );
m_params.emplace_back( new PARAM<bool>( "render.plated_and_bare_copper",
&m_Render.differentiate_plated_copper, false ) );
&m_Render.renderPlatedPadsAsPlated, false ) );
m_params.emplace_back( new PARAM<bool>( "camera.animation_enabled",
&m_Camera.animation_enabled, true ) );
m_params.emplace_back( new PARAM<int>( "camera.moving_speed_multiplier",
@@ -377,13 +205,6 @@ EDA_3D_VIEWER_SETTINGS::EDA_3D_VIEWER_SETTINGS() :
m_params.emplace_back( new PARAM<int>( "camera.projection_mode",
&m_Camera.projection_mode, 1 ) );
m_params.emplace_back( new PARAM<bool>( "use_stackup_colors",
&m_UseStackupColors, true ) );
m_params.emplace_back( new PARAM_LAYER_PRESET_3D( "layer_presets",
&m_LayerPresets ) );
m_params.emplace_back( new PARAM<wxString>( "current_layer_preset",
&m_CurrentPreset, LEGACY_PRESET_FLAG ) );
registerMigration( 0, 1, std::bind( &EDA_3D_VIEWER_SETTINGS::migrateSchema0to1, this ) );
registerMigration( 1, 2,
@@ -392,51 +213,6 @@ EDA_3D_VIEWER_SETTINGS::EDA_3D_VIEWER_SETTINGS() :
Set( "render.opengl_copper_thickness", false );
return true;
} );
registerMigration( 2, 3,
[&]() -> bool
{
if( std::optional<bool> optval = Get<bool>( "render.show_copper" ) )
{
Set( "render.show_copper_top", *optval );
Set( "render.show_copper_bottom", *optval );
}
if( std::optional<bool> optval = Get<bool>( "render.show_silkscreen" ) )
{
Set( "render.show_silkscreen_top", *optval );
Set( "render.show_silkscreen_bottom", *optval );
}
if( std::optional<bool> optval = Get<bool>( "render.show_soldermask" ) )
{
Set( "render.show_soldermask_top", *optval );
Set( "render.show_soldermask_bottom", *optval );
}
if( std::optional<bool> optval = Get<bool>( "render.show_comments" ) )
Set( "render.show_drawings", *optval );
if( std::optional<bool> optval = Get<bool>( "render.show_eco" ) )
{
Set( "render.show_eco1", *optval );
Set( "render.show_eco2", *optval );
}
return true;
} );
}
LAYER_PRESET_3D* EDA_3D_VIEWER_SETTINGS::FindPreset( const wxString& aName )
{
for( LAYER_PRESET_3D& preset : m_LayerPresets )
{
if( preset.name == aName )
return &preset;
}
return nullptr;
}
+9 -72
View File
@@ -2,8 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2020 Jon Evans <jon@craftyjon.com>
* Copyright (C) 2023 CERN
* Copyright (C) 2020-2023 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2020-2022 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@@ -27,55 +26,11 @@
#include <plugins/3dapi/xv3d_types.h>
#include <settings/app_settings.h>
#include <settings/parameters.h>
#include <project/board_project_settings.h>
#include "render_settings.h"
#define FOLLOW_PCB wxT( "follow_pcb_editor" )
#define FOLLOW_PLOT_SETTINGS wxT( "follow_plot_settings" )
#define LEGACY_PRESET_FLAG wxT( "legacy_preset_flag" )
struct LAYER_PRESET_3D
{
LAYER_PRESET_3D( const wxString& aName = wxEmptyString );
LAYER_PRESET_3D( const wxString& aName, const std::bitset<LAYER_3D_END>& aLayers,
const std::map<int, KIGFX::COLOR4D>& aColors ) :
name( aName ),
layers( aLayers ),
colors( aColors )
{
}
wxString name; ///< A name for this layer set
std::bitset<LAYER_3D_END> layers;
std::map<int, KIGFX::COLOR4D> colors;
};
class PARAM_LAYER_PRESET_3D : public PARAM_LAMBDA<nlohmann::json>
{
public:
PARAM_LAYER_PRESET_3D( const std::string& aPath, std::vector<LAYER_PRESET_3D>* aPresetList );
private:
nlohmann::json presetsToJson();
void jsonToPresets( const nlohmann::json& aJson );
std::vector<LAYER_PRESET_3D>* m_presets;
};
class EDA_3D_VIEWER_SETTINGS : public APP_SETTINGS_BASE
{
public:
struct AUI_PANELS
{
int right_panel_width;
bool show_layer_manager;
};
struct RENDER_SETTINGS
{
RENDER_ENGINE engine;
@@ -89,9 +44,8 @@ public:
bool opengl_holes_disableOnMove;
bool opengl_render_bbox_only_OnMove;
bool opengl_copper_thickness;
bool show_model_bbox;
bool show_off_board_silk;
bool highlight_on_rollover;
bool opengl_show_model_bbox;
bool opengl_highlight_on_rollover;
KIGFX::COLOR4D opengl_selection_color;
bool raytrace_anti_aliasing;
@@ -120,32 +74,23 @@ public:
std::vector<int> raytrace_lightElevation; // -90 .. 90
std::vector<int> raytrace_lightAzimuth; // 0 .. 359
bool realistic;
bool show_adhesive;
bool show_axis;
bool show_board_body;
bool show_comments;
bool show_drawings;
bool show_eco1;
bool show_eco2;
bool show_eco;
bool show_footprints_insert;
bool show_footprints_normal;
bool show_footprints_virtual;
bool show_footprints_not_in_posfile;
bool show_footprints_dnp;
bool show_silkscreen_top;
bool show_silkscreen_bottom;
bool show_soldermask_top;
bool show_soldermask_bottom;
bool show_silkscreen;
bool show_soldermask;
bool show_solderpaste;
bool show_copper_top;
bool show_copper_bottom;
bool show_zones;
bool show_fp_references;
bool show_fp_values;
bool show_fp_text;
bool subtract_mask_from_silk;
bool clip_silk_on_via_annuli;
bool differentiate_plated_copper;
bool clip_silk_on_via_annulus;
bool renderPlatedPadsAsPlated;
};
struct CAMERA_SETTINGS
@@ -160,19 +105,11 @@ public:
virtual ~EDA_3D_VIEWER_SETTINGS() {}
LAYER_PRESET_3D* FindPreset( const wxString& aName );
virtual bool MigrateFromLegacy( wxConfigBase* aLegacyConfig ) override;
public:
AUI_PANELS m_AuiPanels;
RENDER_SETTINGS m_Render;
CAMERA_SETTINGS m_Camera;
bool m_UseStackupColors;
std::vector<LAYER_PRESET_3D> m_LayerPresets;
wxString m_CurrentPreset;
protected:
virtual std::string getLegacyFrameName() const override { return "Viewer3DFrameName"; }
+206 -271
View File
@@ -2,8 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2017 Jon Evans <jon@craftyjon.com>
* Copyright (C) 2023 CERN
* Copyright (C) 2017-2023 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2017-2020 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@@ -24,7 +23,6 @@
#include <3d_viewer_id.h>
#include <3d_enums.h>
#include "eda_3d_actions.h"
#include "tool/tool_action.h"
// Actions, being statically-defined, require specialized I18N handling. We continue to
@@ -34,308 +32,245 @@
#undef _
#define _(s) s
// No description, it is not supposed to be shown anywhere
TOOL_ACTION EDA_3D_ACTIONS::controlActivate( TOOL_ACTION_ARGS()
.Name( "3DViewer.Control" )
.Scope( AS_GLOBAL )
.Flags( AF_ACTIVATE ) );
TOOL_ACTION EDA_3D_ACTIONS::pivotCenter( TOOL_ACTION_ARGS()
.Name( "3DViewer.Control.pivotCenter" )
.Scope( AS_ACTIVE )
.DefaultHotkey( ' ' )
.FriendlyName( _( "Set Pivot" ) )
.Tooltip( _( "Place point around which the board will be rotated (middle mouse click)" ) )
.Flags( AF_NONE )
.Parameter( VIEW3D_TYPE::VIEW3D_PIVOT_CENTER ) );
TOOL_ACTION EDA_3D_ACTIONS::controlActivate( "3DViewer.Control", AS_GLOBAL,
0, "", "", "",
BITMAPS::INVALID_BITMAP, AF_ACTIVATE ); // No description, it is not supposed to be shown anywhere
TOOL_ACTION EDA_3D_ACTIONS::rotateXCW( TOOL_ACTION_ARGS()
.Name( "3DViewer.Control.rotateXclockwise" )
.Scope( AS_GLOBAL )
.FriendlyName( _( "Rotate X Clockwise" ) )
.Icon( BITMAPS::rotate_cw_x )
.Flags( AF_NONE )
.Parameter( ROTATION_DIR::X_CW ) );
TOOL_ACTION EDA_3D_ACTIONS::pivotCenter( "3DViewer.Control.pivotCenter",
AS_ACTIVE,
' ', "",
_( "Center pivot rotation" ), _( "Center pivot rotation (middle mouse click)" ),
BITMAPS::INVALID_BITMAP, AF_NONE, (void*) WXK_SPACE );
TOOL_ACTION EDA_3D_ACTIONS::rotateXCCW( TOOL_ACTION_ARGS()
.Name( "3DViewer.Control.rotateXcounterclockwise" )
.Scope( AS_GLOBAL )
.FriendlyName( _( "Rotate X Counterclockwise" ) )
.Icon( BITMAPS::rotate_ccw_x )
.Flags( AF_NONE )
.Parameter( ROTATION_DIR::X_CCW ) );
TOOL_ACTION EDA_3D_ACTIONS::rotateXCW( "3DViewer.Control.rotateXclockwise",
AS_GLOBAL, 0, "",
_( "Rotate X Clockwise" ), _( "Rotate X Clockwise" ),
BITMAPS::rotate_cw_x, AF_NONE, (void*) ROTATION_DIR::X_CW );
TOOL_ACTION EDA_3D_ACTIONS::rotateYCW( TOOL_ACTION_ARGS()
.Name( "3DViewer.Control.rotateYclockwise" )
.Scope( AS_GLOBAL )
.FriendlyName( _( "Rotate Y Clockwise" ) )
.Icon( BITMAPS::rotate_cw_y )
.Flags( AF_NONE )
.Parameter( ROTATION_DIR::Y_CW ) );
TOOL_ACTION EDA_3D_ACTIONS::rotateXCCW( "3DViewer.Control.rotateXcounterclockwise",
AS_GLOBAL, 0, "",
_( "Rotate X Counterclockwise" ), _( "Rotate X Counterclockwise" ),
BITMAPS::rotate_ccw_x, AF_NONE, (void*) ROTATION_DIR::X_CCW );
TOOL_ACTION EDA_3D_ACTIONS::rotateYCCW( TOOL_ACTION_ARGS()
.Name( "3DViewer.Control.rotateYcounterclockwise" )
.Scope( AS_GLOBAL )
.FriendlyName( _( "Rotate Y Counterclockwise" ) )
.Icon( BITMAPS::rotate_ccw_y )
.Flags( AF_NONE )
.Parameter( ROTATION_DIR::Y_CCW ) );
TOOL_ACTION EDA_3D_ACTIONS::rotateYCW( "3DViewer.Control.rotateYclockwise",
AS_GLOBAL, 0, "",
_( "Rotate Y Clockwise" ), _( "Rotate Y Clockwise" ),
BITMAPS::rotate_cw_y, AF_NONE, (void*) ROTATION_DIR::Y_CW );
TOOL_ACTION EDA_3D_ACTIONS::rotateZCW( TOOL_ACTION_ARGS()
.Name( "3DViewer.Control.rotateZclockwise" )
.Scope( AS_GLOBAL )
.FriendlyName( _( "Rotate Z Clockwise" ) )
.Icon( BITMAPS::rotate_cw_z )
.Flags( AF_NONE )
.Parameter( ROTATION_DIR::Z_CW ) );
TOOL_ACTION EDA_3D_ACTIONS::rotateYCCW( "3DViewer.Control.rotateYcounterclockwise",
AS_GLOBAL, 0, "",
_( "Rotate Y Counterclockwise" ), _( "Rotate Y Counterclockwise" ),
BITMAPS::rotate_ccw_y, AF_NONE, (void*) ROTATION_DIR::Y_CCW );
TOOL_ACTION EDA_3D_ACTIONS::rotateZCCW( TOOL_ACTION_ARGS()
.Name( "3DViewer.Control.rotateZcounterclockwise" )
.Scope( AS_GLOBAL )
.FriendlyName( _( "Rotate Z Counterclockwise" ) )
.Icon( BITMAPS::rotate_ccw_z )
.Flags( AF_NONE )
.Parameter( ROTATION_DIR::Z_CCW ) );
TOOL_ACTION EDA_3D_ACTIONS::rotateZCW( "3DViewer.Control.rotateZclockwise",
AS_GLOBAL, 0, "",
_( "Rotate Z Clockwise" ), _( "Rotate Z Clockwise" ),
BITMAPS::rotate_cw_z, AF_NONE, (void*) ROTATION_DIR::Z_CW );
TOOL_ACTION EDA_3D_ACTIONS::moveLeft( TOOL_ACTION_ARGS()
.Name( "3DViewer.Control.moveLeft" )
.Scope( AS_ACTIVE )
.DefaultHotkey( WXK_LEFT )
.FriendlyName( _( "Move Board Left" ) )
.Icon( BITMAPS::left )
.Flags( AF_NONE )
.Parameter( CURSOR_LEFT ) );
TOOL_ACTION EDA_3D_ACTIONS::rotateZCCW( "3DViewer.Control.rotateZcounterclockwise",
AS_GLOBAL, 0, "",
_( "Rotate Z Counterclockwise" ), _( "Rotate Z Counterclockwise" ),
BITMAPS::rotate_ccw_z, AF_NONE, (void*) ROTATION_DIR::Z_CCW );
TOOL_ACTION EDA_3D_ACTIONS::moveRight( TOOL_ACTION_ARGS()
.Name( "3DViewer.Control.moveRight" )
.Scope( AS_ACTIVE )
.DefaultHotkey( WXK_RIGHT )
.FriendlyName( _( "Move Board Right" ) )
.Icon( BITMAPS::right )
.Flags( AF_NONE )
.Parameter( CURSOR_RIGHT ) );
TOOL_ACTION EDA_3D_ACTIONS::moveLeft( "3DViewer.Control.moveLeft",
AS_ACTIVE,
WXK_LEFT, "",
_( "Move board Left" ), _( "Move board Left" ),
BITMAPS::left, AF_NONE, (void*) CURSOR_LEFT );
TOOL_ACTION EDA_3D_ACTIONS::moveUp( TOOL_ACTION_ARGS()
.Name( "3DViewer.Control.moveUp" )
.Scope( AS_ACTIVE )
.DefaultHotkey( WXK_UP )
.FriendlyName( _( "Move Board Up" ) )
.Icon( BITMAPS::up )
.Flags( AF_NONE )
.Parameter( CURSOR_UP ) );
TOOL_ACTION EDA_3D_ACTIONS::moveRight( "3DViewer.Control.moveRight",
AS_ACTIVE,
WXK_RIGHT, "",
_( "Move board Right" ), _( "Move board Right" ),
BITMAPS::right, AF_NONE, (void*) CURSOR_RIGHT );
TOOL_ACTION EDA_3D_ACTIONS::moveDown( TOOL_ACTION_ARGS()
.Name( "3DViewer.Control.moveDown" )
.Scope( AS_ACTIVE )
.DefaultHotkey( WXK_DOWN )
.FriendlyName( _( "Move Board Down" ) )
.Icon( BITMAPS::down )
.Flags( AF_NONE )
.Parameter( CURSOR_DOWN ) );
TOOL_ACTION EDA_3D_ACTIONS::moveUp( "3DViewer.Control.moveUp",
AS_ACTIVE,
WXK_UP, "",
_( "Move board Up" ), _( "Move board Up" ),
BITMAPS::up, AF_NONE, (void*) CURSOR_UP );
TOOL_ACTION EDA_3D_ACTIONS::homeView( TOOL_ACTION_ARGS()
.Name( "3DViewer.Control.homeView" )
.Scope( AS_ACTIVE )
.DefaultHotkey( WXK_HOME )
.FriendlyName ( _( "Home View" ) )
.Tooltip( _( "Redraw at the home position and zoom" ) )
.Flags( AF_NONE )
.Parameter( VIEW3D_TYPE::VIEW3D_FIT_SCREEN ) );
TOOL_ACTION EDA_3D_ACTIONS::moveDown( "3DViewer.Control.moveDown",
AS_ACTIVE,
WXK_DOWN, "",
_( "Move board Down" ), _( "Move board Down" ),
BITMAPS::down, AF_NONE, (void*) CURSOR_DOWN );
TOOL_ACTION EDA_3D_ACTIONS::flipView( TOOL_ACTION_ARGS()
.Name( "3DViewer.Control.flipView" )
.Scope( AS_ACTIVE )
.DefaultHotkey( 'F' )
.FriendlyName( _( "Flip Board" ) )
.Tooltip( _( "Flip the board view" ) )
.Icon( BITMAPS::flip_board )
.Flags( AF_NONE )
.Parameter( VIEW3D_TYPE::VIEW3D_FLIP ) );
TOOL_ACTION EDA_3D_ACTIONS::homeView( "3DViewer.Control.homeView",
AS_ACTIVE,
WXK_HOME, "",
_( "Home view" ), _( "Home view" ),
BITMAPS::INVALID_BITMAP, AF_NONE, (void*) WXK_HOME );
TOOL_ACTION EDA_3D_ACTIONS::toggleOrtho( TOOL_ACTION_ARGS()
.Name( "3DViewer.Control.toggleOrtho" )
.Scope( AS_GLOBAL )
.FriendlyName( _( "Toggle Orthographic Projection" ) )
.Tooltip( _( "Enable/disable orthographic projection" ) )
.Icon( BITMAPS::ortho ) );
TOOL_ACTION EDA_3D_ACTIONS::resetView( "3DViewer.Control.resetView",
AS_ACTIVE,
'R', "",
_( "Reset view" ), _( "Reset view" ),
BITMAPS::INVALID_BITMAP, AF_NONE, (void*) ID_VIEW3D_RESET );
TOOL_ACTION EDA_3D_ACTIONS::viewFront( TOOL_ACTION_ARGS()
.Name( "3DViewer.Control.viewFront" )
.Scope( AS_ACTIVE )
.DefaultHotkey( 'Y' )
.FriendlyName( _( "View Front" ) )
.Icon( BITMAPS::axis3d_front )
.Flags( AF_NONE )
.Parameter( VIEW3D_TYPE::VIEW3D_FRONT ) );
TOOL_ACTION EDA_3D_ACTIONS::flipView( "3DViewer.Control.flipView",
AS_ACTIVE,
'F', "",
_( "Flip Board" ), _( "Flip the board view" ),
BITMAPS::flip_board, AF_NONE, (void*) ID_VIEW3D_FLIP );
TOOL_ACTION EDA_3D_ACTIONS::viewBack( TOOL_ACTION_ARGS()
.Name( "3DViewer.Control.viewBack" )
.Scope( AS_ACTIVE )
.DefaultHotkey( MD_SHIFT + 'Y' )
.FriendlyName( _( "View Back" ) )
.Icon( BITMAPS::axis3d_back )
.Flags( AF_NONE )
.Parameter( VIEW3D_TYPE::VIEW3D_BACK ) );
TOOL_ACTION EDA_3D_ACTIONS::toggleOrtho( "3DViewer.Control.toggleOrtho",
AS_GLOBAL, 0, "",
_( "Toggle orthographic projection" ), _( "Enable/disable orthographic projection" ),
BITMAPS::ortho );
TOOL_ACTION EDA_3D_ACTIONS::viewLeft( TOOL_ACTION_ARGS()
.Name( "3DViewer.Control.viewLeft" )
.Scope( AS_ACTIVE )
.DefaultHotkey( MD_SHIFT + 'X' )
.FriendlyName( _( "View Left" ) )
.Icon( BITMAPS::axis3d_left )
.Flags( AF_NONE )
.Parameter( VIEW3D_TYPE::VIEW3D_LEFT ) );
TOOL_ACTION EDA_3D_ACTIONS::viewFront( "3DViewer.Control.viewFront",
AS_ACTIVE,
'Y', "",
_( "View Front" ), _( "View Front" ),
BITMAPS::axis3d_front, AF_NONE, (void*) ID_VIEW3D_FRONT );
TOOL_ACTION EDA_3D_ACTIONS::viewRight( TOOL_ACTION_ARGS()
.Name( "3DViewer.Control.viewRight" )
.Scope( AS_ACTIVE )
.DefaultHotkey( 'X' )
.FriendlyName( _( "View Right" ) )
.Icon( BITMAPS::axis3d_right )
.Flags( AF_NONE )
.Parameter( VIEW3D_TYPE::VIEW3D_RIGHT ) );
TOOL_ACTION EDA_3D_ACTIONS::viewBack( "3DViewer.Control.viewBack",
AS_ACTIVE,
MD_SHIFT + 'Y', "",
_( "View Back" ), _( "View Back" ),
BITMAPS::axis3d_back, AF_NONE, (void*) ID_VIEW3D_BACK );
TOOL_ACTION EDA_3D_ACTIONS::viewTop( TOOL_ACTION_ARGS()
.Name( "3DViewer.Control.viewTop" )
.Scope( AS_ACTIVE )
.DefaultHotkey( 'Z' )
.FriendlyName( _( "View Top" ) )
.Icon( BITMAPS::axis3d_top )
.Flags( AF_NONE )
.Parameter( VIEW3D_TYPE::VIEW3D_TOP ) );
TOOL_ACTION EDA_3D_ACTIONS::viewLeft( "3DViewer.Control.viewLeft",
AS_ACTIVE,
MD_SHIFT + 'X', "",
_( "View Left" ), _( "View Left" ),
BITMAPS::axis3d_left, AF_NONE, (void*) ID_VIEW3D_LEFT );
TOOL_ACTION EDA_3D_ACTIONS::viewBottom( TOOL_ACTION_ARGS()
.Name( "3DViewer.Control.viewBottom" )
.Scope( AS_ACTIVE )
.DefaultHotkey( MD_SHIFT + 'Z' )
.FriendlyName( _( "View Bottom" ) )
.Icon( BITMAPS::axis3d_bottom )
.Flags( AF_NONE )
.Parameter( VIEW3D_TYPE::VIEW3D_BOTTOM ) );
TOOL_ACTION EDA_3D_ACTIONS::viewRight( "3DViewer.Control.viewRight",
AS_ACTIVE,
'X', "",
_( "View Right" ), _( "View Right" ),
BITMAPS::axis3d_right, AF_NONE, (void*) ID_VIEW3D_RIGHT );
TOOL_ACTION EDA_3D_ACTIONS::noGrid( TOOL_ACTION_ARGS()
.Name( "3DViewer.Control.noGrid" )
.Scope( AS_GLOBAL )
.FriendlyName( _( "No 3D Grid" ) )
.Flags( AF_NONE )
.Parameter( GRID3D_TYPE::NONE ) );
TOOL_ACTION EDA_3D_ACTIONS::viewTop( "3DViewer.Control.viewTop",
AS_ACTIVE,
'Z', "",
_( "View Top" ), _( "View Top" ),
BITMAPS::axis3d_top, AF_NONE, (void*) ID_VIEW3D_TOP );
TOOL_ACTION EDA_3D_ACTIONS::show10mmGrid( TOOL_ACTION_ARGS()
.Name( "3DViewer.Control.show10mmGrid" )
.Scope( AS_GLOBAL )
.FriendlyName( _( "3D Grid 10mm" ) )
.Flags( AF_NONE )
.Parameter( GRID3D_TYPE::GRID_10MM ) );
TOOL_ACTION EDA_3D_ACTIONS::viewBottom( "3DViewer.Control.viewBottom",
AS_ACTIVE,
MD_SHIFT + 'Z', "",
_( "View Bottom" ), _( "View Bottom" ),
BITMAPS::axis3d_bottom, AF_NONE, (void*) ID_VIEW3D_BOTTOM );
TOOL_ACTION EDA_3D_ACTIONS::show5mmGrid( TOOL_ACTION_ARGS()
.Name( "3DViewer.Control.show5mmGrid" )
.Scope( AS_GLOBAL )
.FriendlyName( _( "3D Grid 5mm" ) )
.Flags( AF_NONE )
.Parameter( GRID3D_TYPE::GRID_5MM ) );
TOOL_ACTION EDA_3D_ACTIONS::noGrid( "3DViewer.Control.noGrid",
AS_GLOBAL, 0, "",
_( "No 3D Grid" ), _( "No 3D Grid" ),
BITMAPS::INVALID_BITMAP, AF_NONE, (void*) GRID3D_TYPE::NONE );
TOOL_ACTION EDA_3D_ACTIONS::show2_5mmGrid( TOOL_ACTION_ARGS()
.Name( "3DViewer.Control.show2_5mmGrid" )
.Scope( AS_GLOBAL )
.FriendlyName( _( "3D Grid 2.5mm" ) )
.Flags( AF_NONE )
.Parameter( GRID3D_TYPE::GRID_2P5MM ) );
TOOL_ACTION EDA_3D_ACTIONS::show10mmGrid( "3DViewer.Control.show10mmGrid",
AS_GLOBAL, 0, "",
_( "3D Grid 10mm" ), _( "3D Grid 10mm" ),
BITMAPS::INVALID_BITMAP, AF_NONE, (void*) GRID3D_TYPE::GRID_10MM );
TOOL_ACTION EDA_3D_ACTIONS::show1mmGrid( TOOL_ACTION_ARGS()
.Name( "3DViewer.Control.show1mmGrid" )
.Scope( AS_GLOBAL )
.FriendlyName( _( "3D Grid 1mm" ) )
.Flags( AF_NONE )
.Parameter( GRID3D_TYPE::GRID_1MM ) );
TOOL_ACTION EDA_3D_ACTIONS::show5mmGrid( "3DViewer.Control.show5mmGrid",
AS_GLOBAL, 0, "",
_( "3D Grid 5mm" ), _( "3D Grid 5mm" ),
BITMAPS::INVALID_BITMAP, AF_NONE, (void*) GRID3D_TYPE::GRID_5MM );
TOOL_ACTION EDA_3D_ACTIONS::materialNormal( TOOL_ACTION_ARGS()
.Name( "3DViewer.Control.materialNormal" )
.Scope( AS_ACTIVE )
.FriendlyName( _( "Render Realistic Materials" ) )
.Tooltip( _( "Use all material properties from each 3D model file" ) )
.Flags( AF_NONE )
.Parameter( MATERIAL_MODE::NORMAL ) );
TOOL_ACTION EDA_3D_ACTIONS::show2_5mmGrid( "3DViewer.Control.show2_5mmGrid",
AS_GLOBAL, 0, "",
_( "3D Grid 2.5mm" ), _( "3D Grid 2.5mm" ),
BITMAPS::INVALID_BITMAP, AF_NONE, (void*) GRID3D_TYPE::GRID_2P5MM );
TOOL_ACTION EDA_3D_ACTIONS::materialDiffuse( TOOL_ACTION_ARGS()
.Name( "3DViewer.Control.materialDiffuse" )
.Scope( AS_ACTIVE )
.FriendlyName( _( "Render Solid Colors" ) )
.Tooltip( _( "Use only the diffuse color property from 3D model file" ) )
.Flags( AF_NONE )
.Parameter( MATERIAL_MODE::DIFFUSE_ONLY ) );
TOOL_ACTION EDA_3D_ACTIONS::show1mmGrid( "3DViewer.Control.show1mmGrid",
AS_GLOBAL, 0, "",
_( "3D Grid 1mm" ), _( "3D Grid 1mm" ),
BITMAPS::INVALID_BITMAP, AF_NONE, (void*) GRID3D_TYPE::GRID_1MM );
TOOL_ACTION EDA_3D_ACTIONS::materialCAD( TOOL_ACTION_ARGS()
.Name( "3DViewer.Control.materialCAD" )
.Scope( AS_ACTIVE )
.FriendlyName( _( "Render CAD Colors" ) )
.Tooltip( _( "Use a CAD color style based on the diffuse color of the material" ) )
.Flags( AF_NONE )
.Parameter( MATERIAL_MODE::CAD_MODE ) );
TOOL_ACTION EDA_3D_ACTIONS::materialNormal( "3DViewer.Control.materialNormal",
AS_ACTIVE,
0, "",
_( "Render Realistic Materials" ),
_( "Use all material properties from each 3D model file" ),
BITMAPS::INVALID_BITMAP, AF_NONE, (void*) MATERIAL_MODE::NORMAL );
TOOL_ACTION EDA_3D_ACTIONS::showTHT( TOOL_ACTION_ARGS()
.Name( "3DViewer.Control.attributesTHT" )
.Scope( AS_ACTIVE )
.DefaultHotkey( 'T' )
.FriendlyName( _( "Show Through Hole 3D Models" ) )
.Tooltip( _( "Show 3D models for 'Through hole' type footprints" ) )
.Icon( BITMAPS::show_tht )
.Flags( AF_NONE ) );
TOOL_ACTION EDA_3D_ACTIONS::materialDiffuse( "3DViewer.Control.materialDiffuse",
AS_ACTIVE,
0, "",
_( "Render Solid Colors" ),
_( "Use only the diffuse color property from model 3D model file" ),
BITMAPS::INVALID_BITMAP, AF_NONE, (void*) MATERIAL_MODE::DIFFUSE_ONLY );
TOOL_ACTION EDA_3D_ACTIONS::showSMD( TOOL_ACTION_ARGS()
.Name( "3DViewer.Control.attributesSMD" )
.Scope( AS_ACTIVE )
.DefaultHotkey( 'S' )
.FriendlyName( _( "Show SMD 3D Models" ) )
.Tooltip( _( "Show 3D models for 'Surface mount' type footprints" ) )
.Icon( BITMAPS::show_smt )
.Flags( AF_NONE ) );
TOOL_ACTION EDA_3D_ACTIONS::materialCAD( "3DViewer.Control.materialCAD",
AS_ACTIVE,
0, "",
_( "Render CAD Colors" ),
_( "Use a CAD color style based on the diffuse color of the material" ),
BITMAPS::INVALID_BITMAP, AF_NONE, (void*) MATERIAL_MODE::CAD_MODE );
TOOL_ACTION EDA_3D_ACTIONS::showVirtual( TOOL_ACTION_ARGS()
.Name( "3DViewer.Control.attributesOther" )
.Scope( AS_ACTIVE )
.DefaultHotkey( 'V' )
.FriendlyName( _( "Show Unspecified 3D Models" ) )
.Tooltip( _( "Show 3D models for 'unspecified' type footprints" ) )
.Icon( BITMAPS::show_other )
.Flags( AF_NONE ) );
TOOL_ACTION EDA_3D_ACTIONS::showTHT( "3DViewer.Control.attributesTHT",
AS_ACTIVE,
'T', "",
_( "Toggle Through Hole 3D models" ),
_( "Toggle 3D models for 'Through hole' type components" ),
BITMAPS::show_tht, AF_NONE );
TOOL_ACTION EDA_3D_ACTIONS::showNotInPosFile( TOOL_ACTION_ARGS()
.Name( "3DViewer.Control.attribute_not_in_posfile" )
.Scope( AS_ACTIVE )
.DefaultHotkey( 'P' )
.FriendlyName( _( "Show 3D Models not in POS File" ) )
.Tooltip( _( "Show 3D models even if not found in .pos file" ) )
.Icon( BITMAPS::show_not_in_posfile )
.Flags( AF_NONE ) );
TOOL_ACTION EDA_3D_ACTIONS::showSMD( "3DViewer.Control.attributesSMD",
AS_ACTIVE,
'S', "",
_( "Toggle SMD 3D models" ),
_( "Toggle 3D models for 'Surface mount' type components" ),
BITMAPS::show_smt, AF_NONE );
TOOL_ACTION EDA_3D_ACTIONS::showDNP( TOOL_ACTION_ARGS()
.Name( "3DViewer.Control.attribute_dnp" )
.Scope( AS_ACTIVE )
.DefaultHotkey( 'D' )
.FriendlyName( _( "Show 3D Models marked DNP" ) )
.Tooltip( _( "Show 3D models even if marked 'Do Not Place'" ) )
.Icon( BITMAPS::show_dnp )
.Flags( AF_NONE ) );
TOOL_ACTION EDA_3D_ACTIONS::showVirtual( "3DViewer.Control.attributesOther",
AS_ACTIVE,
'V', "",
_( "Toggle unspecified 3D models" ), _( "Toggle 3D models for 'unspecified' type components" ),
BITMAPS::show_other, AF_NONE );
TOOL_ACTION EDA_3D_ACTIONS::showBBoxes( TOOL_ACTION_ARGS()
.Name( "3DViewer.Control.showBoundingBoxes" )
.Scope( AS_GLOBAL )
.FriendlyName( _( "Show Model Bounding Boxes" ) )
.Tooltip( _( "Show 3D model bounding boxes in realtime renderer" ) )
.Icon( BITMAPS::ortho )
.Flags( AF_NONE ) );
TOOL_ACTION EDA_3D_ACTIONS::showNotInPosFile( "3DViewer.Control.attribute_not_in_posfile",
AS_ACTIVE,
'P', "",
_( "Toggle 3D models not in pos file" ), _( "Toggle 3D models not in pos file" ),
BITMAPS::show_not_in_posfile, AF_NONE );
TOOL_ACTION EDA_3D_ACTIONS::showAxis( TOOL_ACTION_ARGS()
.Name( "3DViewer.Control.showAxis" )
.Scope( AS_GLOBAL )
.FriendlyName( _( "Show 3D Axis" ) )
.Icon( BITMAPS::axis3d_front )
.Flags( AF_NONE ) );
TOOL_ACTION EDA_3D_ACTIONS::showBBoxes( "3DViewer.Control.showBoundingBoxes",
AS_GLOBAL, 0, "",
_( "Show Model Bounding Boxes" ), _( "Show Model Bounding Boxes" ),
BITMAPS::ortho, AF_NONE );
TOOL_ACTION EDA_3D_ACTIONS::showLayersManager( TOOL_ACTION_ARGS()
.Name( "3DViewer.Control.showLayersManager" )
.Scope( AS_GLOBAL )
.FriendlyName( _( "Show Appearance Manager" ) )
.Tooltip( _( "Show/hide the appearance manager" ) )
.Icon( BITMAPS::layers_manager ) );
TOOL_ACTION EDA_3D_ACTIONS::toggleRealisticMode( "3DViewer.Control.toggleRealisticMode",
AS_GLOBAL, 0, "",
_( "Toggle realistic mode" ), _( "Toggle realistic mode" ) );
TOOL_ACTION EDA_3D_ACTIONS::toggleBoardBody( "3DViewer.Control.toggleBoardBody",
AS_GLOBAL, 0, "",
_( "Toggle board body display" ), _( "Toggle board body display" ) );
TOOL_ACTION EDA_3D_ACTIONS::showAxis( "3DViewer.Control.showAxis",
AS_GLOBAL, 0, "",
_( "Show 3D Axis" ), _( "Show 3D Axis" ),
BITMAPS::axis3d_front, AF_NONE );
TOOL_ACTION EDA_3D_ACTIONS::toggleZones( "3DViewer.Control.toggleZones",
AS_GLOBAL, 0, "",
_( "Toggle zone display" ), _( "Toggle zone display" ) );
TOOL_ACTION EDA_3D_ACTIONS::toggleAdhesive( "3DViewer.Control.toggleAdhesive",
AS_GLOBAL, 0, "",
_( "Toggle adhesive display" ), _( "Toggle display of adhesive layers" ) );
TOOL_ACTION EDA_3D_ACTIONS::toggleSilk( "3DViewer.Control.toggleSilk",
AS_GLOBAL, 0, "",
_( "Toggle silkscreen display" ), _( "Toggle display of silkscreen layers" ) );
TOOL_ACTION EDA_3D_ACTIONS::toggleSolderMask( "3DViewer.Control.toggleSolderMask",
AS_GLOBAL, 0, "",
_( "Toggle solder mask display" ), _( "Toggle display of solder mask layers" ) );
TOOL_ACTION EDA_3D_ACTIONS::toggleSolderPaste( "3DViewer.Control.toggleSolderPaste",
AS_GLOBAL, 0, "",
_( "Toggle solder paste display" ), _( "Toggle display of solder paste layers" ) );
TOOL_ACTION EDA_3D_ACTIONS::toggleComments( "3DViewer.Control.toggleComments",
AS_GLOBAL, 0, "",
_( "Toggle comments display" ), _( "Toggle display of comments and drawings layers" ) );
TOOL_ACTION EDA_3D_ACTIONS::toggleECO( "3DViewer.Control.toggleECO",
AS_GLOBAL, 0, "",
_( "Toggle ECO display" ), _( "Toggle display of ECO layers" ) );
+12 -4
View File
@@ -1,8 +1,8 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2013-2023 CERN
* Copyright (C) 2020-2023 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2013-2016 CERN
* Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors.
* @author Maciej Suminski <maciej.suminski@cern.ch>
*
* This program is free software; you can redistribute it and/or
@@ -54,6 +54,7 @@ public:
static TOOL_ACTION moveUp;
static TOOL_ACTION moveDown;
static TOOL_ACTION homeView;
static TOOL_ACTION resetView;
static TOOL_ACTION flipView;
static TOOL_ACTION toggleOrtho;
@@ -78,10 +79,17 @@ public:
static TOOL_ACTION showSMD;
static TOOL_ACTION showVirtual;
static TOOL_ACTION showNotInPosFile;
static TOOL_ACTION showDNP;
static TOOL_ACTION showBBoxes;
static TOOL_ACTION toggleRealisticMode;
static TOOL_ACTION toggleBoardBody;
static TOOL_ACTION showAxis;
static TOOL_ACTION showLayersManager;
static TOOL_ACTION toggleZones;
static TOOL_ACTION toggleAdhesive;
static TOOL_ACTION toggleSilk;
static TOOL_ACTION toggleSolderMask;
static TOOL_ACTION toggleSolderPaste;
static TOOL_ACTION toggleComments;
static TOOL_ACTION toggleECO;
};
#endif
+116 -52
View File
@@ -1,8 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2023 CERN
* Copyright (C) 2020-2023 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -29,9 +28,8 @@
#include <id.h>
#include <kiface_base.h>
#include <tools/eda_3d_controller.h>
#include <tools/eda_3d_actions.h>
#include <dialogs/panel_preview_3d_model.h>
#include <dialogs/appearance_controls_3D.h>
#include "eda_3d_actions.h"
#include "dialogs/panel_preview_3d_model.h"
#include <3d_rendering/opengl/render_3d_opengl.h>
@@ -81,7 +79,8 @@ void EDA_3D_CONTROLLER::Reset( RESET_REASON aReason )
{
m_canvas = dynamic_cast<EDA_3D_CANVAS*>( holder->GetToolCanvas() );
EDA_3D_BOARD_HOLDER* holder3d = dynamic_cast<EDA_3D_BOARD_HOLDER*>( holder );
EDA_3D_BOARD_HOLDER* holder3d =
dynamic_cast<EDA_3D_BOARD_HOLDER*>( holder );
wxASSERT( holder3d );
@@ -118,7 +117,10 @@ int EDA_3D_CONTROLLER::Main( const TOOL_EVENT& aEvent )
if( evt->IsCancelInteractive() )
{
wxWindow* canvas = m_toolMgr->GetToolHolder()->GetToolCanvas();
wxWindow* topLevelParent = wxGetTopLevelParent( canvas->GetParent() );
wxWindow* topLevelParent = canvas->GetParent();
while( topLevelParent && !topLevelParent->IsTopLevel() )
topLevelParent = topLevelParent->GetParent();
if( topLevelParent && dynamic_cast<DIALOG_SHIM*>( topLevelParent ) )
{
@@ -150,7 +152,7 @@ int EDA_3D_CONTROLLER::Main( const TOOL_EVENT& aEvent )
int EDA_3D_CONTROLLER::ViewControl( const TOOL_EVENT& aEvent )
{
m_canvas->SetView3D( aEvent.Parameter<VIEW3D_TYPE>() );
m_canvas->SetView3D( aEvent.Parameter<intptr_t>() );
return 0;
}
@@ -158,13 +160,13 @@ int EDA_3D_CONTROLLER::ViewControl( const TOOL_EVENT& aEvent )
int EDA_3D_CONTROLLER::PanControl( const TOOL_EVENT& aEvent )
{
switch( aEvent.Parameter<ACTIONS::CURSOR_EVENT_TYPE>() )
switch( aEvent.Parameter<intptr_t>() )
{
case ACTIONS::CURSOR_UP: m_canvas->SetView3D( VIEW3D_TYPE::VIEW3D_PAN_UP ); break;
case ACTIONS::CURSOR_DOWN: m_canvas->SetView3D( VIEW3D_TYPE::VIEW3D_PAN_DOWN ); break;
case ACTIONS::CURSOR_LEFT: m_canvas->SetView3D( VIEW3D_TYPE::VIEW3D_PAN_LEFT ); break;
case ACTIONS::CURSOR_RIGHT: m_canvas->SetView3D( VIEW3D_TYPE::VIEW3D_PAN_RIGHT ); break;
default: wxFAIL; break;
case ACTIONS::CURSOR_UP: m_canvas->SetView3D( WXK_UP ); break;
case ACTIONS::CURSOR_DOWN: m_canvas->SetView3D( WXK_DOWN ); break;
case ACTIONS::CURSOR_LEFT: m_canvas->SetView3D( WXK_LEFT ); break;
case ACTIONS::CURSOR_RIGHT: m_canvas->SetView3D( WXK_RIGHT ); break;
default: wxFAIL; break;
}
return 0;
@@ -184,7 +186,7 @@ int EDA_3D_CONTROLLER::RotateView( const TOOL_EVENT& aEvent )
case ROTATION_DIR::Y_CCW: m_camera->RotateY( -rotIncrement ); break;
case ROTATION_DIR::Z_CW: m_camera->RotateZ( -rotIncrement ); break;
case ROTATION_DIR::Z_CCW: m_camera->RotateZ( rotIncrement ); break;
default: wxFAIL; break;
default: wxFAIL; break;
}
if( m_boardAdapter->m_Cfg->m_Render.engine == RENDER_ENGINE::OPENGL )
@@ -223,44 +225,95 @@ int EDA_3D_CONTROLLER::ToggleOrtho( const TOOL_EVENT& aEvent )
int EDA_3D_CONTROLLER::ToggleVisibility( const TOOL_EVENT& aEvent )
{
std::bitset<LAYER_3D_END> visibilityFlags = m_boardAdapter->GetVisibleLayers();
APPEARANCE_CONTROLS_3D* appearanceManager = nullptr;
bool reload = false;
auto flipLayer =
[&]( int layer )
{
appearanceManager->OnLayerVisibilityChanged( layer, !visibilityFlags.test( layer ) );
};
#define FLIP( x ) x = !x
if( auto viewer = dynamic_cast<EDA_3D_VIEWER_FRAME*>( m_toolMgr->GetToolHolder() ) )
appearanceManager = viewer->GetAppearanceManager();
if( appearanceManager )
if( aEvent.IsAction( &EDA_3D_ACTIONS::showTHT ) )
{
if( aEvent.IsAction( &EDA_3D_ACTIONS::showTHT ) )
flipLayer( LAYER_3D_TH_MODELS );
else if( aEvent.IsAction( &EDA_3D_ACTIONS::showSMD ) )
flipLayer( LAYER_3D_SMD_MODELS );
else if( aEvent.IsAction( &EDA_3D_ACTIONS::showVirtual ) )
flipLayer( LAYER_3D_VIRTUAL_MODELS );
else if( aEvent.IsAction( &EDA_3D_ACTIONS::showNotInPosFile ) )
flipLayer( LAYER_3D_MODELS_NOT_IN_POS );
else if( aEvent.IsAction( &EDA_3D_ACTIONS::showDNP ) )
flipLayer( LAYER_3D_MODELS_MARKED_DNP );
else if( aEvent.IsAction( &EDA_3D_ACTIONS::showAxis ) )
flipLayer( LAYER_3D_AXES );
else if( aEvent.IsAction( &EDA_3D_ACTIONS::showBBoxes ) )
flipLayer( LAYER_3D_BOUNDING_BOXES );
FLIP( m_boardAdapter->m_Cfg->m_Render.show_footprints_normal );
reload = true;
}
else if( aEvent.IsAction( &EDA_3D_ACTIONS::showSMD ) )
{
FLIP( m_boardAdapter->m_Cfg->m_Render.show_footprints_insert );
reload = true;
}
else if( aEvent.IsAction( &EDA_3D_ACTIONS::showVirtual ) )
{
FLIP( m_boardAdapter->m_Cfg->m_Render.show_footprints_virtual );
reload = true;
}
else if( aEvent.IsAction( &EDA_3D_ACTIONS::showNotInPosFile ) )
{
FLIP( m_boardAdapter->m_Cfg->m_Render.show_footprints_not_in_posfile );
reload = true;
}
else if( aEvent.IsAction( &EDA_3D_ACTIONS::showBBoxes ) )
{
FLIP( m_boardAdapter->m_Cfg->m_Render.opengl_show_model_bbox );
}
else if( aEvent.IsAction( &EDA_3D_ACTIONS::toggleRealisticMode ) )
{
FLIP( m_boardAdapter->m_Cfg->m_Render.realistic );
}
else if( aEvent.IsAction( &EDA_3D_ACTIONS::toggleBoardBody ) )
{
FLIP( m_boardAdapter->m_Cfg->m_Render.show_board_body );
}
else if( aEvent.IsAction( &EDA_3D_ACTIONS::showAxis ) )
{
FLIP( m_boardAdapter->m_Cfg->m_Render.show_axis );
}
else if( aEvent.IsAction( &EDA_3D_ACTIONS::toggleZones ) )
{
FLIP( m_boardAdapter->m_Cfg->m_Render.show_zones );
}
else if( aEvent.IsAction( &EDA_3D_ACTIONS::toggleAdhesive ) )
{
FLIP( m_boardAdapter->m_Cfg->m_Render.show_adhesive );
}
else if( aEvent.IsAction( &EDA_3D_ACTIONS::toggleSilk ) )
{
FLIP( m_boardAdapter->m_Cfg->m_Render.show_silkscreen );
}
else if( aEvent.IsAction( &EDA_3D_ACTIONS::toggleSolderMask ) )
{
FLIP( m_boardAdapter->m_Cfg->m_Render.show_soldermask );
}
else if( aEvent.IsAction( &EDA_3D_ACTIONS::toggleSolderPaste ) )
{
FLIP( m_boardAdapter->m_Cfg->m_Render.show_solderpaste );
}
else if( aEvent.IsAction( &EDA_3D_ACTIONS::toggleComments ) )
{
FLIP( m_boardAdapter->m_Cfg->m_Render.show_comments );
}
else if( aEvent.IsAction( &EDA_3D_ACTIONS::toggleECO ) )
{
FLIP( m_boardAdapter->m_Cfg->m_Render.show_eco );
}
return 0;
}
int EDA_3D_CONTROLLER::ToggleLayersManager( const TOOL_EVENT& aEvent )
{
if( auto* viewer = dynamic_cast<EDA_3D_VIEWER_FRAME*>( m_toolMgr->GetToolHolder() ) )
viewer->ToggleAppearanceManager();
if( reload )
{
if( m_boardAdapter->m_Cfg->m_Render.engine == RENDER_ENGINE::OPENGL )
{
auto* renderer = static_cast<RENDER_3D_OPENGL*>( m_canvas->GetCurrentRender() );
renderer->Load3dModelsIfNeeded();
m_canvas->Request_refresh();
}
else
{
m_canvas->RenderRaytracingRequest();
}
}
else
{
if( auto viewer = dynamic_cast<EDA_3D_VIEWER_FRAME*>( m_toolMgr->GetToolHolder() ) )
viewer->NewDisplay( true );
else
m_canvas->Request_refresh();
}
return 0;
}
@@ -302,7 +355,7 @@ int EDA_3D_CONTROLLER::doZoomInOut( bool aDirection, bool aCenterOnCursor )
{
if( m_canvas )
{
m_canvas->SetView3D( aDirection ? VIEW3D_TYPE::VIEW3D_ZOOM_IN : VIEW3D_TYPE::VIEW3D_ZOOM_OUT );
m_canvas->SetView3D( aDirection ? WXK_F1 : WXK_F2 );
m_canvas->DisplayStatus();
}
@@ -314,7 +367,7 @@ int EDA_3D_CONTROLLER::ZoomFitScreen( const TOOL_EVENT& aEvent )
{
if( m_canvas )
{
m_canvas->SetView3D( VIEW3D_TYPE::VIEW3D_FIT_SCREEN );
m_canvas->SetView3D( WXK_HOME );
m_canvas->DisplayStatus();
}
@@ -346,6 +399,7 @@ void EDA_3D_CONTROLLER::setTransitions()
Go( &EDA_3D_CONTROLLER::ViewControl, EDA_3D_ACTIONS::viewBack.MakeEvent() );
Go( &EDA_3D_CONTROLLER::ViewControl, EDA_3D_ACTIONS::pivotCenter.MakeEvent() );
Go( &EDA_3D_CONTROLLER::ViewControl, EDA_3D_ACTIONS::homeView.MakeEvent() );
Go( &EDA_3D_CONTROLLER::ViewControl, EDA_3D_ACTIONS::resetView.MakeEvent() );
Go( &EDA_3D_CONTROLLER::ViewControl, EDA_3D_ACTIONS::flipView.MakeEvent() );
Go( &EDA_3D_CONTROLLER::RotateView, EDA_3D_ACTIONS::rotateXCW.MakeEvent() );
Go( &EDA_3D_CONTROLLER::RotateView, EDA_3D_ACTIONS::rotateXCCW.MakeEvent() );
@@ -383,8 +437,18 @@ void EDA_3D_CONTROLLER::setTransitions()
Go( &EDA_3D_CONTROLLER::ToggleVisibility, EDA_3D_ACTIONS::showSMD.MakeEvent() );
Go( &EDA_3D_CONTROLLER::ToggleVisibility, EDA_3D_ACTIONS::showVirtual.MakeEvent() );
Go( &EDA_3D_CONTROLLER::ToggleVisibility, EDA_3D_ACTIONS::showNotInPosFile.MakeEvent() );
Go( &EDA_3D_CONTROLLER::ToggleVisibility, EDA_3D_ACTIONS::showDNP.MakeEvent() );
Go( &EDA_3D_CONTROLLER::ToggleLayersManager,EDA_3D_ACTIONS::showLayersManager.MakeEvent() );
Go( &EDA_3D_CONTROLLER::ToggleVisibility, EDA_3D_ACTIONS::showVirtual.MakeEvent() );
Go( &EDA_3D_CONTROLLER::ToggleVisibility, EDA_3D_ACTIONS::showBBoxes.MakeEvent() );
Go( &EDA_3D_CONTROLLER::ToggleVisibility, EDA_3D_ACTIONS::toggleRealisticMode.MakeEvent() );
Go( &EDA_3D_CONTROLLER::ToggleVisibility, EDA_3D_ACTIONS::toggleBoardBody.MakeEvent() );
Go( &EDA_3D_CONTROLLER::ToggleVisibility, EDA_3D_ACTIONS::showAxis.MakeEvent() );
Go( &EDA_3D_CONTROLLER::ToggleVisibility, EDA_3D_ACTIONS::toggleZones.MakeEvent() );
Go( &EDA_3D_CONTROLLER::ToggleVisibility, EDA_3D_ACTIONS::toggleAdhesive.MakeEvent() );
Go( &EDA_3D_CONTROLLER::ToggleVisibility, EDA_3D_ACTIONS::toggleSilk.MakeEvent() );
Go( &EDA_3D_CONTROLLER::ToggleVisibility, EDA_3D_ACTIONS::toggleSolderMask.MakeEvent() );
Go( &EDA_3D_CONTROLLER::ToggleVisibility, EDA_3D_ACTIONS::toggleSolderPaste.MakeEvent() );
Go( &EDA_3D_CONTROLLER::ToggleVisibility, EDA_3D_ACTIONS::toggleComments.MakeEvent() );
Go( &EDA_3D_CONTROLLER::ToggleVisibility, EDA_3D_ACTIONS::toggleECO.MakeEvent() );
}
@@ -1,8 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2023 CERN
* Copyright (C) 2020-2023 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -96,7 +95,6 @@ public:
int ToggleOrtho( const TOOL_EVENT& aEvent );
int ToggleVisibility( const TOOL_EVENT& aEvent );
int ToggleLayersManager( const TOOL_EVENT& aEvent );
private:
///< Sets up handlers for various events.
+10 -19
View File
@@ -1,21 +1,5 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2023 <author>
* Copyright (C) 2023 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
/**
* @file 3d_viewer_id.h
*/
/**
@@ -27,7 +11,6 @@
* However the number of IDs should be < ROOM_FOR_3D_VIEWER, defined in id.h
* Please change the value of ROOM_FOR_3D_VIEWER if too small.
*/
#pragma once
#include <id.h> // Generic Id.
@@ -35,6 +18,14 @@ enum id_3dview_frm
{
ID_START_COMMAND_3D = ID_KICAD_3D_VIEWER_START,
ID_RELOAD3D_BOARD,
ID_VIEW3D_TOP,
ID_VIEW3D_BOTTOM,
ID_VIEW3D_LEFT,
ID_VIEW3D_RIGHT,
ID_VIEW3D_FRONT,
ID_VIEW3D_BACK,
ID_VIEW3D_RESET,
ID_VIEW3D_FLIP,
ID_TOOL_SCREENCOPY_TOCLIBBOARD,
ID_MENU_SCREENCOPY_PNG,
+18 -17
View File
@@ -1,5 +1,5 @@
#add_definitions(-DPRINT_STATISTICS_3D_VIEWER)
add_compile_definitions( PCBNEW )
add_definitions(-DPCBNEW)
include_directories(BEFORE ${INC_BEFORE})
include_directories(
@@ -16,6 +16,7 @@ include_directories(
)
# directories
set( DIR_DLG dialogs )
set( DIR_RAY 3d_rendering/raytracing )
set( DIR_RAY_ACC ${DIR_RAY}/accelerators )
set( DIR_RAY_2D ${DIR_RAY}/shapes2D )
@@ -27,9 +28,15 @@ set(3D-VIEWER_SRCS
${DIR_3D_PLUGINS}/3d/pluginldr3D.cpp
3d_cache/3d_cache.cpp
3d_cache/3d_plugin_manager.cpp
${DIR_DLG}/3d_cache_dialogs.cpp
${DIR_DLG}/dialog_select_3d_model_base.cpp
${DIR_DLG}/dialog_select_3d_model.cpp
${DIR_DLG}/panel_preview_3d_model_base.cpp
${DIR_DLG}/panel_preview_3d_model.cpp
3d_canvas/board_adapter.cpp
3d_canvas/create_layer_items.cpp
3d_canvas/create_3Dgraphic_brd_items.cpp
3d_canvas/create_layer_poly.cpp
3d_canvas/eda_3d_canvas.cpp
3d_canvas/eda_3d_canvas_pivot.cpp
3d_model_viewer/eda_3d_model_viewer.cpp
@@ -71,6 +78,7 @@ set(3D-VIEWER_SRCS
${DIR_RAY_3D}/triangle_3d.cpp
3d_rendering/buffers_debug.cpp
3d_rendering/render_3d_base.cpp
3d_rendering/camera.cpp
3d_rendering/color_rgb.cpp
3d_rendering/image.cpp
3d_rendering/post_shader.cpp
@@ -80,6 +88,14 @@ set(3D-VIEWER_SRCS
3d_rendering/trackball.cpp
3d_viewer/3d_menubar.cpp
3d_viewer/3d_toolbar.cpp
dialogs/panel_3D_colors.cpp
dialogs/panel_3D_colors_base.cpp
dialogs/panel_3D_display_options.cpp
dialogs/panel_3D_display_options_base.cpp
dialogs/panel_3D_opengl_options.cpp
dialogs/panel_3D_opengl_options_base.cpp
dialogs/panel_3D_raytracing_options.cpp
dialogs/panel_3D_raytracing_options_base.cpp
3d_viewer/tools/eda_3d_actions.cpp
3d_viewer/tools/eda_3d_conditions.cpp
3d_viewer/tools/eda_3d_controller.cpp
@@ -89,19 +105,6 @@ set(3D-VIEWER_SRCS
common_ogl/ogl_utils.cpp
3d_fastmath.cpp
3d_math.cpp
dialogs/3d_cache_dialogs.cpp
dialogs/appearance_controls_3D.cpp
dialogs/appearance_controls_3D_base.cpp
dialogs/dialog_select_3d_model_base.cpp
dialogs/dialog_select_3d_model.cpp
dialogs/panel_preview_3d_model_base.cpp
dialogs/panel_preview_3d_model.cpp
dialogs/panel_3D_display_options.cpp
dialogs/panel_3D_display_options_base.cpp
dialogs/panel_3D_opengl_options.cpp
dialogs/panel_3D_opengl_options_base.cpp
dialogs/panel_3D_raytracing_options.cpp
dialogs/panel_3D_raytracing_options_base.cpp
)
add_library(3d-viewer STATIC ${3D-VIEWER_SRCS})
@@ -111,10 +114,8 @@ target_link_libraries( 3d-viewer
PRIVATE
gal
kimath
core
common
nlohmann_json
Boost::headers
${Boost_LIBRARIES}
${wxWidgets_LIBRARIES}
${OPENGL_LIBRARIES}
kicad_3dsg )
-2
View File
@@ -31,11 +31,9 @@
#define OPENGL_INCLUDES_H
#ifdef __APPLE__
#ifndef GL_SILENCE_DEPRECATION
// Apple, in their infinite wisdom, has decided to mark OpenGL as deprecated.
// Luckily we can silence warnings about its deprecation.
#define GL_SILENCE_DEPRECATION 1
#endif
#include <OpenGL/gl.h>
#include <OpenGL/glu.h>
#else
@@ -1,978 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2023 CERN
* Copyright (C) 2023-2024 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <dialogs/appearance_controls_3D.h>
#include <bitmaps.h>
#include <confirm.h>
#include <pgm_base.h>
#include <dpi_scaling_common.h>
#include <eda_list_dialog.h>
#include <pcb_display_options.h>
#include <eda_3d_viewer_frame.h>
#include <pcbnew_settings.h>
#include <project.h>
#include <settings/settings_manager.h>
#include <settings/color_settings.h>
#include <tool/tool_manager.h>
#include <tools/pcb_actions.h>
#include <tools/eda_3d_actions.h>
#include <widgets/bitmap_toggle.h>
#include <widgets/color_swatch.h>
#include <widgets/grid_bitmap_toggle.h>
#include <dialogs/eda_view_switcher.h>
#include <wx/bmpbuttn.h>
#include <wx/sizer.h>
#include <wx/textdlg.h>
#include <wx/checkbox.h>
#include <../3d_rendering/opengl/render_3d_opengl.h>
#define RR APPEARANCE_CONTROLS_3D::APPEARANCE_SETTING_3D // Render Row abbreviation to reduce source width
/// Template for object appearance settings
const APPEARANCE_CONTROLS_3D::APPEARANCE_SETTING_3D APPEARANCE_CONTROLS_3D::s_layerSettings[] = {
// text id tooltip
RR( _HKI( "Board Body" ), LAYER_3D_BOARD, _HKI( "Show board body" ) ),
RR( _HKI( "F.Cu" ), LAYER_3D_COPPER_TOP, _HKI( "Show front copper / surface finish color" ) ),
RR( _HKI( "B.Cu" ), LAYER_3D_COPPER_BOTTOM, _HKI( "Show back copper / surface finish color" ) ),
RR( _HKI( "Adhesive" ), LAYER_3D_ADHESIVE, _HKI( "Show adhesive" ) ),
RR( _HKI( "Solder Paste" ), LAYER_3D_SOLDERPASTE, _HKI( "Show solder paste" ) ),
RR( _HKI( "F.Silkscreen" ), LAYER_3D_SILKSCREEN_TOP, _HKI( "Show front silkscreen" ) ),
RR( _HKI( "B.Silkscreen" ), LAYER_3D_SILKSCREEN_BOTTOM, _HKI( "Show back silkscreen" ) ),
RR( _HKI( "F.Mask" ), LAYER_3D_SOLDERMASK_TOP, _HKI( "Show front solder mask" ) ),
RR( _HKI( "B.Mask" ), LAYER_3D_SOLDERMASK_BOTTOM, _HKI( "Show back solder mask" ) ),
RR( _HKI( "User.Drawings" ), LAYER_3D_USER_DRAWINGS, _HKI( "Show user drawings layer" ) ),
RR( _HKI( "User.Comments" ), LAYER_3D_USER_COMMENTS, _HKI( "Show user comments layer" ) ),
RR( _HKI( "User.Eco1" ), LAYER_3D_USER_ECO1, _HKI( "Show user ECO1 layer" ) ),
RR( _HKI( "User.Eco2" ), LAYER_3D_USER_ECO2, _HKI( "Show user ECO2 layer" ) ),
RR(),
RR( _HKI( "Through-hole Models" ), LAYER_3D_TH_MODELS, EDA_3D_ACTIONS::showTHT ),
RR( _HKI( "SMD Models" ), LAYER_3D_SMD_MODELS, EDA_3D_ACTIONS::showSMD ),
RR( _HKI( "Virtual Models" ), LAYER_3D_VIRTUAL_MODELS, EDA_3D_ACTIONS::showVirtual ),
RR( _HKI( "Models not in POS File" ), LAYER_3D_MODELS_NOT_IN_POS, EDA_3D_ACTIONS::showNotInPosFile ),
RR( _HKI( "Models marked DNP" ), LAYER_3D_MODELS_MARKED_DNP, EDA_3D_ACTIONS::showDNP ),
RR( _HKI( "Model Bounding Boxes" ), LAYER_3D_BOUNDING_BOXES, EDA_3D_ACTIONS::showBBoxes ),
RR(),
RR( _HKI( "Values" ), LAYER_FP_VALUES, _HKI( "Show footprint values" ) ),
RR( _HKI( "References" ), LAYER_FP_REFERENCES, _HKI( "Show footprint references" ) ),
RR( _HKI( "Footprint Text" ), LAYER_FP_TEXT, _HKI( "Show all footprint text" ) ),
RR( _HKI( "Off-board Silkscreen" ), LAYER_3D_OFF_BOARD_SILK, _HKI( "Do not clip silk layers to board outline" ) ),
RR(),
RR( _HKI( "3D Axis" ), LAYER_3D_AXES, EDA_3D_ACTIONS::showAxis ),
RR( _HKI( "Background Start" ), LAYER_3D_BACKGROUND_TOP, _HKI( "Background gradient start color" ) ),
RR( _HKI( "Background End" ), LAYER_3D_BACKGROUND_BOTTOM, _HKI( "Background gradient end color" ) ),
};
// The list of IDs that can have colors coming from the board stackup, and cannot be
// modified if use colors from stackup is activated
static std::vector<int> inStackupColors{ LAYER_3D_BOARD, LAYER_3D_COPPER_TOP,
LAYER_3D_COPPER_BOTTOM, LAYER_3D_SOLDERPASTE,
LAYER_3D_SILKSCREEN_TOP, LAYER_3D_SILKSCREEN_BOTTOM,
LAYER_3D_SOLDERMASK_TOP, LAYER_3D_SOLDERMASK_BOTTOM
};
APPEARANCE_CONTROLS_3D::APPEARANCE_CONTROLS_3D( EDA_3D_VIEWER_FRAME* aParent,
wxWindow* aFocusOwner ) :
APPEARANCE_CONTROLS_3D_BASE( aParent ),
m_frame( aParent ),
m_focusOwner( aFocusOwner ),
m_lastSelectedViewport( nullptr )
{
DPI_SCALING_COMMON dpi( nullptr, m_frame );
int indicatorSize = ConvertDialogToPixels( wxSize( 6, 6 ) ).x / dpi.GetContentScaleFactor();
int screenHeight = wxSystemSettings::GetMetric( wxSYS_SCREEN_Y );
m_pointSize = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT ).GetPointSize();
m_layerPanelColour = m_panelLayers->GetBackgroundColour().ChangeLightness( 110 );
SetBorders( true, false, false, false );
m_layersOuterSizer = new wxBoxSizer( wxVERTICAL );
m_windowLayers->SetSizer( m_layersOuterSizer );
m_windowLayers->SetScrollRate( 0, 5 );
m_windowLayers->Bind( wxEVT_SET_FOCUS, &APPEARANCE_CONTROLS_3D::OnSetFocus, this );
m_envOuterSizer = new wxBoxSizer( wxVERTICAL );
wxFont infoFont = KIUI::GetInfoFont( this );
m_panelLayers->SetFont( infoFont );
m_windowLayers->SetFont( infoFont );
m_presetsLabel->SetFont( infoFont );
m_viewportsLabel->SetFont( infoFont );
// Create display options
m_cbUseBoardStackupColors = new wxCheckBox( m_panelLayers, wxID_ANY,
_( "Use board stackup colors" ) );
m_cbUseBoardStackupColors->SetFont( infoFont );
m_cbUseBoardStackupColors->Bind( wxEVT_CHECKBOX,
[this]( wxCommandEvent& aEvent )
{
EDA_3D_VIEWER_SETTINGS* cfg = m_frame->GetAdapter().m_Cfg;
cfg->m_UseStackupColors = aEvent.IsChecked();
UpdateLayerCtls();
syncLayerPresetSelection();
m_frame->NewDisplay( true );
} );
m_panelLayersSizer->Add( m_cbUseBoardStackupColors, 0, wxEXPAND | wxTOP | wxLEFT | wxRIGHT, 7 );
m_cbLayerPresets->SetToolTip( wxString::Format( _( "Save and restore color and visibility "
"combinations.\n"
"Use %s+Tab to activate selector.\n"
"Successive Tabs while holding %s down will "
"cycle through presets in the popup." ),
KeyNameFromKeyCode( PRESET_SWITCH_KEY ),
KeyNameFromKeyCode( PRESET_SWITCH_KEY ) ) );
m_cbViewports->SetToolTip( wxString::Format( _( "Save and restore camera position and zoom.\n"
"Use %s+Tab to activate selector.\n"
"Successive Tabs while holding %s down will "
"cycle through viewports in the popup." ),
KeyNameFromKeyCode( VIEWPORT_SWITCH_KEY ),
KeyNameFromKeyCode( VIEWPORT_SWITCH_KEY ) ) );
if( screenHeight <= 900 && m_pointSize >= indicatorSize )
m_pointSize = m_pointSize * 8 / 10;
m_cbLayerPresets->Bind( wxEVT_CHOICE, &APPEARANCE_CONTROLS_3D::onLayerPresetChanged, this );
m_toggleGridRenderer = new GRID_BITMAP_TOGGLE_RENDERER( KiBitmap( BITMAPS::visibility ),
KiBitmap( BITMAPS::visibility_off ) );
}
APPEARANCE_CONTROLS_3D::~APPEARANCE_CONTROLS_3D()
{
}
wxSize APPEARANCE_CONTROLS_3D::GetBestSize() const
{
DPI_SCALING_COMMON dpi( nullptr, m_frame );
wxSize size( 220 * dpi.GetScaleFactor(), 480 * dpi.GetScaleFactor() );
return size;
}
void APPEARANCE_CONTROLS_3D::OnSetFocus( wxFocusEvent& aEvent )
{
#ifdef __WXMSW__
// In wxMSW, buttons won't process events unless they have focus, so we'll let it take the
// focus and give it back to the parent in the button event handler.
if( wxBitmapButton* btn = dynamic_cast<wxBitmapButton*>( aEvent.GetEventObject() ) )
{
wxCommandEvent evt( wxEVT_BUTTON );
wxPostEvent( btn, evt );
}
#endif
passOnFocus();
aEvent.Skip();
}
void APPEARANCE_CONTROLS_3D::OnSize( wxSizeEvent& aEvent )
{
aEvent.Skip();
}
void APPEARANCE_CONTROLS_3D::OnLanguageChanged()
{
Freeze();
rebuildLayers();
m_cbUseBoardStackupColors->SetLabel( _( "Use board stackup colors" ) );
rebuildLayerPresetsWidget();
rebuildViewportsWidget();
Thaw();
Refresh();
}
void APPEARANCE_CONTROLS_3D::OnDarkModeToggle()
{
// This is essentially a list of hacks because DarkMode isn't yet implemented inside
// wxWidgets.
//
// The individual wxPanels, COLOR_SWATCHes and GRID_CELL_COLOR_RENDERERs should really be
// overriding some virtual method or responding to some wxWidgets event so that the parent
// doesn't have to know what it contains. But, that's not where we are, so... :shrug:
m_layerPanelColour = m_panelLayers->GetBackgroundColour().ChangeLightness( 110 );
m_windowLayers->SetBackgroundColour( m_layerPanelColour );
for( wxSizerItem* child : m_layersOuterSizer->GetChildren() )
{
if( child && child->GetWindow() )
child->GetWindow()->SetBackgroundColour( m_layerPanelColour );
}
}
void APPEARANCE_CONTROLS_3D::CommonSettingsChanged()
{
OnLanguageChanged();
UpdateLayerCtls();
syncLayerPresetSelection();
}
void APPEARANCE_CONTROLS_3D::ApplyLayerPreset( const wxString& aPresetName )
{
if( aPresetName == FOLLOW_PCB || aPresetName == FOLLOW_PLOT_SETTINGS )
{
m_frame->GetAdapter().m_Cfg->m_CurrentPreset = aPresetName;
UpdateLayerCtls();
m_frame->NewDisplay( true );
}
else if( LAYER_PRESET_3D* preset = m_frame->GetAdapter().m_Cfg->FindPreset( aPresetName ) )
{
doApplyLayerPreset( *preset );
}
// Move to front of MRU list
if( m_presetMRU.Index( aPresetName ) != wxNOT_FOUND )
m_presetMRU.Remove( aPresetName );
m_presetMRU.Insert( aPresetName, 0 );
updateLayerPresetWidget( aPresetName );
}
std::vector<VIEWPORT3D> APPEARANCE_CONTROLS_3D::GetUserViewports() const
{
std::vector<VIEWPORT3D> ret;
for( const auto& [name, viewport] : m_viewports )
ret.emplace_back( viewport );
return ret;
}
void APPEARANCE_CONTROLS_3D::SetUserViewports( std::vector<VIEWPORT3D>& aViewportList )
{
m_viewports.clear();
for( const VIEWPORT3D& viewport : aViewportList )
{
if( m_viewports.count( viewport.name ) )
continue;
m_viewports[viewport.name] = viewport;
m_viewportMRU.Add( viewport.name );
}
rebuildViewportsWidget();
// Now is as good a time as any to initialize the layer presets as well.
rebuildLayerPresetsWidget();
m_presetMRU.Add( FOLLOW_PCB );
m_presetMRU.Add( FOLLOW_PLOT_SETTINGS );
for( const LAYER_PRESET_3D& preset : m_frame->GetAdapter().m_Cfg->m_LayerPresets )
m_presetMRU.Add( preset.name );
}
void APPEARANCE_CONTROLS_3D::ApplyViewport( const wxString& aViewportName )
{
int idx = m_cbViewports->FindString( aViewportName );
if( idx >= 0 && idx < (int)m_cbViewports->GetCount() - 3 /* separator */ )
{
m_cbViewports->SetSelection( idx );
m_lastSelectedViewport = static_cast<VIEWPORT3D*>( m_cbViewports->GetClientData( idx ) );
}
else
{
m_cbViewports->SetSelection( m_cbViewports->GetCount() - 3 ); // separator
m_lastSelectedViewport = nullptr;
}
if( m_lastSelectedViewport )
doApplyViewport( *m_lastSelectedViewport );
}
void APPEARANCE_CONTROLS_3D::OnLayerVisibilityChanged( int aLayer, bool isVisible )
{
std::bitset<LAYER_3D_END> visibleLayers = m_frame->GetAdapter().GetVisibleLayers();
const std::map<int, COLOR4D>& colors = m_frame->GetAdapter().GetLayerColors();
bool killFollow = false;
bool doFastRefresh = false; // true to just refresh the display
// Special-case controls
switch( aLayer )
{
case LAYER_FP_TEXT:
// Because Footprint Text is a meta-control that also can disable values/references,
// drag them along here so that the user is less likely to be confused.
if( !isVisible )
{
visibleLayers.set( LAYER_FP_REFERENCES, false );
visibleLayers.set( LAYER_FP_VALUES, false );
}
visibleLayers.set( LAYER_FP_TEXT, isVisible );
killFollow = true;
break;
case LAYER_FP_REFERENCES:
case LAYER_FP_VALUES:
// In case that user changes Footprint Value/References when the Footprint Text
// meta-control is disabled, we should put it back on.
if( isVisible )
visibleLayers.set( LAYER_FP_TEXT, true );
visibleLayers.set( aLayer, isVisible );
killFollow = true;
break;
case LAYER_3D_BOARD:
case LAYER_3D_COPPER_TOP:
case LAYER_3D_COPPER_BOTTOM:
case LAYER_3D_SILKSCREEN_BOTTOM:
case LAYER_3D_SILKSCREEN_TOP:
case LAYER_3D_SOLDERMASK_BOTTOM:
case LAYER_3D_SOLDERMASK_TOP:
case LAYER_3D_SOLDERPASTE:
case LAYER_3D_ADHESIVE:
case LAYER_3D_USER_COMMENTS:
case LAYER_3D_USER_DRAWINGS:
case LAYER_3D_USER_ECO1:
case LAYER_3D_USER_ECO2:
visibleLayers.set( aLayer, isVisible );
killFollow = true;
break;
case LAYER_3D_TH_MODELS:
case LAYER_3D_SMD_MODELS:
case LAYER_3D_VIRTUAL_MODELS:
case LAYER_3D_MODELS_NOT_IN_POS:
case LAYER_3D_MODELS_MARKED_DNP:
doFastRefresh = true;
visibleLayers.set( aLayer, isVisible );
break;
default:
visibleLayers.set( aLayer, isVisible );
break;
}
m_frame->GetAdapter().SetVisibleLayers( visibleLayers );
m_frame->GetAdapter().SetLayerColors( colors );
const wxString& currentPreset = m_frame->GetAdapter().m_Cfg->m_CurrentPreset;
if( ( currentPreset != FOLLOW_PCB && currentPreset != FOLLOW_PLOT_SETTINGS ) || killFollow )
syncLayerPresetSelection();
UpdateLayerCtls();
if( doFastRefresh && m_frame->GetAdapter().m_Cfg->m_Render.engine == RENDER_ENGINE::OPENGL )
{
RENDER_3D_OPENGL* renderer =
static_cast<RENDER_3D_OPENGL*>( m_frame->GetCanvas()->GetCurrentRender() );
renderer->Load3dModelsIfNeeded();
m_frame->GetCanvas()->Request_refresh();
}
else
{
m_frame->NewDisplay( true );
}
}
void APPEARANCE_CONTROLS_3D::onColorSwatchChanged( COLOR_SWATCH* aSwatch )
{
std::bitset<LAYER_3D_END> visibleLayers = m_frame->GetAdapter().GetVisibleLayers();
std::map<int, COLOR4D> colors = m_frame->GetAdapter().GetLayerColors();
m_frame->GetAdapter().SetVisibleLayers( visibleLayers );
m_frame->GetAdapter().SetLayerColors( colors );
int layer = aSwatch->GetId();
COLOR4D newColor = aSwatch->GetSwatchColor();
colors[ layer ] = newColor;
if( layer == LAYER_3D_COPPER_TOP )
colors[ LAYER_3D_COPPER_BOTTOM ] = newColor;
else if( layer == LAYER_3D_COPPER_BOTTOM )
colors[ LAYER_3D_COPPER_TOP ] = newColor;
m_frame->GetAdapter().SetLayerColors( colors );
syncLayerPresetSelection();
m_frame->NewDisplay( true );
}
void APPEARANCE_CONTROLS_3D::rebuildLayers()
{
int swatchWidth = m_windowLayers->ConvertDialogToPixels( wxSize( 8, 0 ) ).x;
std::bitset<LAYER_3D_END> visibleLayers = m_frame->GetAdapter().GetVisibleLayers();
std::map<int, COLOR4D> colors = m_frame->GetAdapter().GetLayerColors();
std::map<int, COLOR4D> defaultColors = m_frame->GetAdapter().GetDefaultColors();
m_layerSettings.clear();
m_layersOuterSizer->Clear( true );
m_layersOuterSizer->AddSpacer( 5 );
m_envOuterSizer->Clear( true );
auto appendLayer =
[&]( const std::unique_ptr<APPEARANCE_SETTING_3D>& aSetting )
{
wxBoxSizer* sizer = new wxBoxSizer( wxHORIZONTAL );
int layer = aSetting->m_Id;
aSetting->m_Visible = visibleLayers.test( layer );
if( colors.count( layer ) )
{
COLOR_SWATCH* swatch = new COLOR_SWATCH( m_windowLayers, colors[ layer ], layer,
COLOR4D::WHITE, defaultColors[ layer ],
SWATCH_SMALL );
swatch->SetToolTip( _( "Left double click or middle click to change color" ) );
swatch->SetReadOnlyCallback(
[this]()
{
WX_INFOBAR* infobar = m_frame->GetInfoBar();
infobar->RemoveAllButtons();
infobar->AddCloseButton();
infobar->ShowMessageFor( _( "Uncheck 'Use board stackup colors' to "
"allow color editing." ),
10000, wxICON_INFORMATION );
} );
sizer->Add( swatch, 0, wxALIGN_CENTER_VERTICAL, 0 );
aSetting->m_Ctl_color = swatch;
swatch->Bind( COLOR_SWATCH_CHANGED,
[this]( wxCommandEvent& event )
{
auto swatch = static_cast<COLOR_SWATCH*>( event.GetEventObject() );
onColorSwatchChanged( swatch );
passOnFocus();
} );
}
else
{
sizer->AddSpacer( swatchWidth );
}
sizer->AddSpacer( 5 );
wxStaticText* label = new wxStaticText( m_windowLayers, layer, aSetting->GetLabel() );
label->Wrap( -1 );
label->SetToolTip( aSetting->GetTooltip() );
if( layer == LAYER_3D_BACKGROUND_TOP || layer == LAYER_3D_BACKGROUND_BOTTOM )
{
sizer->AddSpacer( swatchWidth );
}
else
{
BITMAP_TOGGLE* btn_visible = new BITMAP_TOGGLE( m_windowLayers, layer,
KiBitmap( BITMAPS::visibility ),
KiBitmap( BITMAPS::visibility_off ),
aSetting->m_Visible );
btn_visible->Bind( TOGGLE_CHANGED,
[this]( wxCommandEvent& aEvent )
{
int id = static_cast<wxWindow*>( aEvent.GetEventObject() )->GetId();
bool isVisible = aEvent.GetInt();
OnLayerVisibilityChanged( id, isVisible );
passOnFocus();
} );
wxString tip;
tip.Printf( _( "Show or hide %s" ), aSetting->GetLabel().Lower() );
btn_visible->SetToolTip( tip );
aSetting->m_Ctl_visibility = btn_visible;
sizer->Add( btn_visible, 0, wxALIGN_CENTER_VERTICAL, 0 );
}
sizer->AddSpacer( 5 );
sizer->Add( label, 0, wxALIGN_CENTER_VERTICAL, 0 );
m_layersOuterSizer->Add( sizer, 0, wxEXPAND | wxLEFT | wxRIGHT, 5 );
m_layersOuterSizer->AddSpacer( 2 );
};
for( const APPEARANCE_SETTING_3D& s_setting : s_layerSettings )
{
m_layerSettings.emplace_back( std::make_unique<APPEARANCE_SETTING_3D>( s_setting ) );
std::unique_ptr<APPEARANCE_SETTING_3D>& setting = m_layerSettings.back();
if( setting->m_Spacer )
m_layersOuterSizer->AddSpacer( m_pointSize );
else
appendLayer( setting );
m_layerSettingsMap[setting->m_Id] = setting.get();
}
m_sizerOuter->Layout();
}
void APPEARANCE_CONTROLS_3D::UpdateLayerCtls()
{
EDA_3D_VIEWER_SETTINGS* cfg = m_frame->GetAdapter().m_Cfg;
std::bitset<LAYER_3D_END> visibleLayers = m_frame->GetAdapter().GetVisibleLayers();
std::map<int, COLOR4D> colors = m_frame->GetAdapter().GetLayerColors();
for( std::unique_ptr<APPEARANCE_SETTING_3D>& setting : m_layerSettings )
{
if( setting->m_Spacer )
continue;
if( setting->m_Ctl_visibility )
setting->m_Ctl_visibility->SetValue( visibleLayers.test( setting->m_Id ) );
if( setting->m_Ctl_color )
{
setting->m_Ctl_color->SetSwatchColor( colors[ setting->m_Id ], false );
// if cfg->m_UseStackupColors is set, board colors cannot be modified locally, but
// other colors can be
if( std::find( inStackupColors.begin(), inStackupColors.end(), setting->m_Id )
!= inStackupColors.end() )
{
if( cfg )
setting->m_Ctl_color->SetReadOnly( cfg->m_UseStackupColors );
}
}
}
if( cfg )
m_cbUseBoardStackupColors->SetValue( cfg->m_UseStackupColors );
}
void APPEARANCE_CONTROLS_3D::rebuildLayerPresetsWidget()
{
m_presetsLabel->SetLabel( wxString::Format( _( "Presets (%s+Tab):" ),
KeyNameFromKeyCode( PRESET_SWITCH_KEY ) ) );
m_cbLayerPresets->Clear();
// Build the layers preset list.
m_cbLayerPresets->Append( _( "Follow PCB Editor" ) );
m_cbLayerPresets->Append( _( "Follow PCB Plot Settings" ) );
for( const LAYER_PRESET_3D& preset : m_frame->GetAdapter().m_Cfg->m_LayerPresets )
m_cbLayerPresets->Append( preset.name );
m_cbLayerPresets->Append( wxT( "---" ) );
m_cbLayerPresets->Append( _( "Save preset..." ) );
m_cbLayerPresets->Append( _( "Delete preset..." ) );
updateLayerPresetWidget( m_frame->GetAdapter().m_Cfg->m_CurrentPreset );
}
void APPEARANCE_CONTROLS_3D::syncLayerPresetSelection()
{
m_frame->GetAdapter().m_Cfg->m_CurrentPreset = wxEmptyString;
std::vector<LAYER_PRESET_3D>& presets = m_frame->GetAdapter().m_Cfg->m_LayerPresets;
std::bitset<LAYER_3D_END> visibleLayers = m_frame->GetAdapter().GetVisibleLayers();
std::map<int, COLOR4D> colors = m_frame->GetAdapter().GetLayerColors();
auto it = std::find_if(
presets.begin(), presets.end(),
[&]( const LAYER_PRESET_3D& aPreset )
{
if( aPreset.name.Lower() == _( "legacy colors" )
&& m_cbUseBoardStackupColors->GetValue() )
{
return false;
}
for( int layer = LAYER_3D_BOARD; layer < LAYER_3D_END; ++layer )
{
if( aPreset.layers.test( layer ) != visibleLayers.test( layer ) )
return false;
}
for( int layer : { LAYER_FP_REFERENCES, LAYER_FP_VALUES, LAYER_FP_TEXT } )
{
if( aPreset.layers.test( layer ) != visibleLayers.test( layer ) )
return false;
}
for( int layer = LAYER_3D_START + 1; layer < LAYER_3D_END; ++layer )
{
auto it1 = aPreset.colors.find( layer );
auto it2 = colors.find( layer );
if( it1 != aPreset.colors.end() && it2 != colors.end() && *it1 != *it2 )
return false;
}
return true;
} );
if( it != presets.end() )
{
m_frame->GetAdapter().m_Cfg->m_CurrentPreset = it->name;
m_cbLayerPresets->SetStringSelection( it->name );
}
else
{
m_cbLayerPresets->SetSelection( m_cbLayerPresets->GetCount() - 3 ); // separator
}
}
void APPEARANCE_CONTROLS_3D::updateLayerPresetWidget( const wxString& aName )
{
if( aName == FOLLOW_PCB )
m_cbLayerPresets->SetSelection( 0 );
else if( aName == FOLLOW_PLOT_SETTINGS )
m_cbLayerPresets->SetSelection( 1 );
else if( !m_cbLayerPresets->SetStringSelection( aName ) )
m_cbLayerPresets->SetSelection( m_cbLayerPresets->GetCount() - 3 ); // separator
}
void APPEARANCE_CONTROLS_3D::onLayerPresetChanged( wxCommandEvent& aEvent )
{
EDA_3D_VIEWER_SETTINGS* cfg = m_frame->GetAdapter().m_Cfg;
int count = m_cbLayerPresets->GetCount();
int index = m_cbLayerPresets->GetSelection();
wxString name;
auto resetSelection =
[&]()
{
updateLayerPresetWidget( cfg->m_CurrentPreset );
};
if( index == 0 )
{
name = FOLLOW_PCB;
cfg->m_CurrentPreset = name;
UpdateLayerCtls();
m_frame->NewDisplay( true );
}
else if( index == 1 )
{
name = FOLLOW_PLOT_SETTINGS;
cfg->m_CurrentPreset = name;
UpdateLayerCtls();
m_frame->NewDisplay( true );
}
else if( index == count - 3 )
{
// Separator: reject the selection
resetSelection();
return;
}
else if( index == count - 2 )
{
wxTextEntryDialog dlg( wxGetTopLevelParent( this ), _( "Layer preset name:" ),
_( "Save Layer Preset" ) );
if( dlg.ShowModal() != wxID_OK )
{
resetSelection();
return;
}
std::bitset<LAYER_3D_END> visibleLayers = m_frame->GetAdapter().GetVisibleLayers();
std::map<int, COLOR4D> colors = m_frame->GetAdapter().GetLayerColors();
name = dlg.GetValue();
if( LAYER_PRESET_3D* preset = cfg->FindPreset( name ) )
{
if( !IsOK( wxGetTopLevelParent( this ), _( "Overwrite existing preset?" ) ) )
{
resetSelection();
return;
}
preset->layers = visibleLayers;
preset->colors = colors;
m_cbLayerPresets->SetSelection( m_cbLayerPresets->FindString( name ) );
}
else
{
cfg->m_LayerPresets.emplace_back( name, visibleLayers, colors );
m_cbLayerPresets->SetSelection( m_cbLayerPresets->Insert( name, index - 1 ) );
}
cfg->m_CurrentPreset = name;
m_presetMRU.Insert( name, 0 );
return;
}
else if( index == count - 1 )
{
wxArrayString headers;
std::vector<wxArrayString> items;
headers.Add( _( "Presets" ) );
for( LAYER_PRESET_3D& preset : cfg->m_LayerPresets )
{
wxArrayString item;
item.Add( preset.name );
items.emplace_back( item );
}
EDA_LIST_DIALOG dlg( m_frame, _( "Delete Preset" ), headers, items );
dlg.SetListLabel( _( "Select preset:" ) );
if( dlg.ShowModal() == wxID_OK )
{
name = dlg.GetTextSelection();
if( m_cbLayerPresets->FindString( name ) != wxNOT_FOUND )
m_cbLayerPresets->Delete( m_cbLayerPresets->FindString( name ) );
alg::delete_if( cfg->m_LayerPresets,
[name]( const LAYER_PRESET_3D& preset )
{
return preset.name == name;
} );
if( cfg->m_CurrentPreset == name )
cfg->m_CurrentPreset = wxEmptyString;
m_presetMRU.Remove( name );
}
resetSelection();
return;
}
else if( LAYER_PRESET_3D* preset = cfg->FindPreset( m_cbLayerPresets->GetStringSelection() ) )
{
name = preset->name;
doApplyLayerPreset( *preset );
}
// Move to front of MRU list
if( m_presetMRU.Index( name ) != wxNOT_FOUND )
m_presetMRU.Remove( name );
m_presetMRU.Insert( name, 0 );
passOnFocus();
}
void APPEARANCE_CONTROLS_3D::doApplyLayerPreset( const LAYER_PRESET_3D& aPreset )
{
BOARD_ADAPTER& adapter = m_frame->GetAdapter();
adapter.m_Cfg->m_CurrentPreset = aPreset.name;
adapter.SetVisibleLayers( aPreset.layers );
adapter.SetLayerColors( aPreset.colors );
if( aPreset.name.Lower() == _( "legacy colors" ) )
adapter.m_Cfg->m_UseStackupColors = false;
UpdateLayerCtls();
m_frame->NewDisplay( true );
}
void APPEARANCE_CONTROLS_3D::rebuildViewportsWidget()
{
m_viewportsLabel->SetLabel( wxString::Format( _( "Viewports (%s+Tab):" ),
KeyNameFromKeyCode( VIEWPORT_SWITCH_KEY ) ) );
m_cbViewports->Clear();
for( std::pair<const wxString, VIEWPORT3D>& pair : m_viewports )
m_cbViewports->Append( pair.first, static_cast<void*>( &pair.second ) );
m_cbViewports->Append( wxT( "---" ) );
m_cbViewports->Append( _( "Save viewport..." ) );
m_cbViewports->Append( _( "Delete viewport..." ) );
m_cbViewports->SetSelection( m_cbViewports->GetCount() - 3 );
m_lastSelectedViewport = nullptr;
}
void APPEARANCE_CONTROLS_3D::onViewportChanged( wxCommandEvent& aEvent )
{
int count = m_cbViewports->GetCount();
int index = m_cbViewports->GetSelection();
if( index >= 0 && index < count - 3 )
{
VIEWPORT3D* viewport = static_cast<VIEWPORT3D*>( m_cbViewports->GetClientData( index ) );
wxCHECK( viewport, /* void */ );
doApplyViewport( *viewport );
if( !viewport->name.IsEmpty() )
{
m_viewportMRU.Remove( viewport->name );
m_viewportMRU.Insert( viewport->name, 0 );
}
}
else if( index == count - 2 )
{
// Save current state to new preset
wxString name;
wxTextEntryDialog dlg( wxGetTopLevelParent( this ), _( "Viewport name:" ),
_( "Save Viewport" ), name );
if( dlg.ShowModal() != wxID_OK )
{
if( m_lastSelectedViewport )
m_cbViewports->SetStringSelection( m_lastSelectedViewport->name );
else
m_cbViewports->SetSelection( m_cbViewports->GetCount() - 3 );
return;
}
name = dlg.GetValue();
bool exists = m_viewports.count( name );
if( !exists )
{
m_viewports[name] = VIEWPORT3D( name, m_frame->GetCurrentCamera().GetViewMatrix() );
index = m_cbViewports->Insert( name, index-1, static_cast<void*>( &m_viewports[name] ) );
}
else
{
m_viewports[name].matrix = m_frame->GetCurrentCamera().GetViewMatrix();
index = m_cbViewports->FindString( name );
m_viewportMRU.Remove( name );
}
m_cbViewports->SetSelection( index );
m_viewportMRU.Insert( name, 0 );
return;
}
else if( index == count - 1 )
{
// Delete an existing viewport
wxArrayString headers;
std::vector<wxArrayString> items;
headers.Add( _( "Viewports" ) );
for( std::pair<const wxString, VIEWPORT3D>& pair : m_viewports )
{
wxArrayString item;
item.Add( pair.first );
items.emplace_back( item );
}
EDA_LIST_DIALOG dlg( m_frame, _( "Delete Viewport" ), headers, items );
dlg.SetListLabel( _( "Select viewport:" ) );
if( dlg.ShowModal() == wxID_OK )
{
wxString viewportName = dlg.GetTextSelection();
int idx = m_cbViewports->FindString( viewportName );
if( idx != wxNOT_FOUND )
{
m_viewports.erase( viewportName );
m_cbViewports->Delete( idx );
m_viewportMRU.Remove( viewportName );
}
}
if( m_lastSelectedViewport )
m_cbViewports->SetStringSelection( m_lastSelectedViewport->name );
else
m_cbViewports->SetSelection( m_cbViewports->GetCount() - 3 );
return;
}
passOnFocus();
}
void APPEARANCE_CONTROLS_3D::onUpdateViewportsCb( wxUpdateUIEvent& aEvent )
{
int count = m_cbViewports->GetCount();
int index = m_cbViewports->GetSelection();
if( index >= 0 && index < count - 3 )
{
VIEWPORT3D* viewport = static_cast<VIEWPORT3D*>( m_cbViewports->GetClientData( index ) );
wxCHECK( viewport, /* void */ );
if( m_frame->GetCurrentCamera().GetViewMatrix() != viewport->matrix )
m_cbViewports->SetSelection( -1 );
}
}
void APPEARANCE_CONTROLS_3D::doApplyViewport( const VIEWPORT3D& aViewport )
{
m_frame->GetCurrentCamera().SetViewMatrix( aViewport.matrix );
if( m_frame->GetAdapter().m_Cfg->m_Render.engine == RENDER_ENGINE::OPENGL )
m_frame->GetCanvas()->Request_refresh();
else
m_frame->GetCanvas()->RenderRaytracingRequest();
}
void APPEARANCE_CONTROLS_3D::passOnFocus()
{
m_focusOwner->SetFocus();
}
-191
View File
@@ -1,191 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2023 CERN
* Copyright (C) 2023 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef APPEARANCE_CONTROLS_3D_H
#define APPEARANCE_CONTROLS_3D_H
#include <vector>
#include <gal/color4d.h>
#include <layer_ids.h>
#include <3d_canvas/board_adapter.h>
#include <dialogs/appearance_controls_3D_base.h>
#include <tool/tool_action.h>
#include <wx/intl.h>
class BITMAP_TOGGLE;
class COLOR_SWATCH;
class EDA_3D_VIEWER_FRAME;
class ROW_ICON_PROVIDER;
class GRID_BITMAP_TOGGLE_RENDERER;
using KIGFX::COLOR4D;
class APPEARANCE_CONTROLS_3D : public APPEARANCE_CONTROLS_3D_BASE
{
public:
/**
* Container for an appearance setting (can control a layer class, object type, etc.)
*/
class APPEARANCE_SETTING_3D
{
public:
int m_Id;
bool m_Visible;
bool m_Spacer;
BITMAP_TOGGLE* m_Ctl_visibility;
COLOR_SWATCH* m_Ctl_color;
APPEARANCE_SETTING_3D( const wxString& aLabel, int aId, const wxString& aTooltip ) :
m_Id( aId ),
m_Visible( true ),
m_Spacer( false ),
m_Ctl_visibility( nullptr ),
m_Ctl_color( nullptr ),
m_tooltip( aTooltip ),
m_label( aLabel )
{
}
APPEARANCE_SETTING_3D( const wxString& aLabel, int aId, const TOOL_ACTION& aAction ) :
m_Id( aId ),
m_Visible( true ),
m_Spacer( false ),
m_Ctl_visibility( nullptr ),
m_Ctl_color( nullptr ),
m_label( aLabel ),
m_action( &aAction )
{
}
APPEARANCE_SETTING_3D() :
m_Id( -1 ),
m_Visible( false ),
m_Spacer( true ),
m_Ctl_visibility( nullptr ),
m_Ctl_color( nullptr )
{
}
wxString GetTooltip() const
{
if( m_tooltip.has_value() )
return wxGetTranslation( m_tooltip.value() );
else if( m_action.has_value() )
return m_action.value()->GetTooltip( true );
else
return wxEmptyString;
}
wxString GetLabel() const
{
return wxGetTranslation( m_label );
}
private:
wxString m_label;
std::optional<wxString> m_tooltip;
std::optional<const TOOL_ACTION*> m_action;
};
APPEARANCE_CONTROLS_3D( EDA_3D_VIEWER_FRAME* aParent, wxWindow* aFocusOwner );
~APPEARANCE_CONTROLS_3D();
wxSize GetBestSize() const;
void OnLanguageChanged();
void OnDarkModeToggle();
void OnLayerVisibilityChanged( int aLayer, bool isVisible );
void CommonSettingsChanged();
void UpdateLayerCtls();
void ApplyLayerPreset( const wxString& aPresetName );
const wxArrayString& GetLayerPresetsMRU() { return m_presetMRU; }
///< Return a list of viewports created by the user.
std::vector<VIEWPORT3D> GetUserViewports() const;
///< Update the current viewports from those saved in the project file.
void SetUserViewports( std::vector<VIEWPORT3D>& aPresetList );
void ApplyViewport( const wxString& aPresetName );
const wxArrayString& GetViewportsMRU() { return m_viewportMRU; }
protected:
void OnSetFocus( wxFocusEvent& aEvent ) override;
void OnSize( wxSizeEvent& aEvent ) override;
private:
void rebuildLayers();
void rebuildLayerPresetsWidget();
void syncLayerPresetSelection();
void rebuildViewportsWidget();
void onColorSwatchChanged( COLOR_SWATCH* aSwatch );
void updateLayerPresetWidget( const wxString& aName );
void onLayerPresetChanged( wxCommandEvent& aEvent ) override;
void doApplyLayerPreset( const LAYER_PRESET_3D& aPreset );
void onViewportChanged( wxCommandEvent& aEvent ) override;
void onUpdateViewportsCb( wxUpdateUIEvent& aEvent ) override;
void doApplyViewport( const VIEWPORT3D& aViewport );
void passOnFocus();
private:
static const APPEARANCE_SETTING_3D s_layerSettings[];
EDA_3D_VIEWER_FRAME* m_frame;
wxWindow* m_focusOwner;
std::vector<std::unique_ptr<APPEARANCE_SETTING_3D>> m_layerSettings;
std::map<int, APPEARANCE_SETTING_3D*> m_layerSettingsMap;
wxArrayString m_presetMRU;
std::map<wxString, VIEWPORT3D> m_viewports;
VIEWPORT3D* m_lastSelectedViewport;
wxArrayString m_viewportMRU;
wxBoxSizer* m_layersOuterSizer;
wxBoxSizer* m_envOuterSizer;
int m_pointSize;
wxColour m_layerPanelColour;
GRID_BITMAP_TOGGLE_RENDERER* m_toggleGridRenderer;
wxCheckBox* m_cbUseBoardStackupColors;
};
#endif
@@ -1,98 +0,0 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "appearance_controls_3D_base.h"
///////////////////////////////////////////////////////////////////////////
APPEARANCE_CONTROLS_3D_BASE::APPEARANCE_CONTROLS_3D_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : WX_PANEL( parent, id, pos, size, style, name )
{
this->SetMinSize( wxSize( 200,360 ) );
m_sizerOuter = new wxBoxSizer( wxVERTICAL );
m_panelLayers = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
m_panelLayersSizer = new wxBoxSizer( wxVERTICAL );
m_windowLayers = new wxScrolledCanvas( m_panelLayers, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL );
m_panelLayersSizer->Add( m_windowLayers, 1, wxEXPAND, 5 );
m_panelLayers->SetSizer( m_panelLayersSizer );
m_panelLayers->Layout();
m_panelLayersSizer->Fit( m_panelLayers );
m_sizerOuter->Add( m_panelLayers, 1, wxEXPAND, 5 );
wxBoxSizer* bBottomMargin;
bBottomMargin = new wxBoxSizer( wxVERTICAL );
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bBottomMargin->Add( m_staticline1, 0, wxEXPAND|wxBOTTOM, 3 );
wxBoxSizer* bPresets;
bPresets = new wxBoxSizer( wxVERTICAL );
m_presetsLabel = new wxStaticText( this, wxID_ANY, _("Presets (Ctrl+Tab):"), wxDefaultPosition, wxDefaultSize, 0 );
m_presetsLabel->Wrap( -1 );
bPresets->Add( m_presetsLabel, 1, wxRIGHT|wxLEFT, 2 );
wxString m_cbLayerPresetsChoices[] = { _("Follow PCB Editor"), _("Follow PCB Plot Settings") };
int m_cbLayerPresetsNChoices = sizeof( m_cbLayerPresetsChoices ) / sizeof( wxString );
m_cbLayerPresets = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_cbLayerPresetsNChoices, m_cbLayerPresetsChoices, 0 );
m_cbLayerPresets->SetSelection( 1 );
bPresets->Add( m_cbLayerPresets, 0, wxALL|wxEXPAND, 2 );
bBottomMargin->Add( bPresets, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
bBottomMargin->Add( 0, 2, 0, wxEXPAND, 5 );
wxBoxSizer* bViewports;
bViewports = new wxBoxSizer( wxVERTICAL );
m_viewportsLabel = new wxStaticText( this, wxID_ANY, _("Viewports (Alt+Tab):"), wxDefaultPosition, wxDefaultSize, 0 );
m_viewportsLabel->Wrap( -1 );
bViewports->Add( m_viewportsLabel, 1, wxRIGHT|wxLEFT, 2 );
wxString m_cbViewportsChoices[] = { _("(unsaved)") };
int m_cbViewportsNChoices = sizeof( m_cbViewportsChoices ) / sizeof( wxString );
m_cbViewports = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_cbViewportsNChoices, m_cbViewportsChoices, 0 );
m_cbViewports->SetSelection( 1 );
bViewports->Add( m_cbViewports, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 2 );
bBottomMargin->Add( bViewports, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_sizerOuter->Add( bBottomMargin, 0, wxEXPAND|wxTOP|wxBOTTOM, 2 );
this->SetSizer( m_sizerOuter );
this->Layout();
m_sizerOuter->Fit( this );
// Connect Events
this->Connect( wxEVT_SET_FOCUS, wxFocusEventHandler( APPEARANCE_CONTROLS_3D_BASE::OnSetFocus ) );
this->Connect( wxEVT_SIZE, wxSizeEventHandler( APPEARANCE_CONTROLS_3D_BASE::OnSize ) );
m_panelLayers->Connect( wxEVT_SET_FOCUS, wxFocusEventHandler( APPEARANCE_CONTROLS_3D_BASE::OnSetFocus ), NULL, this );
m_cbLayerPresets->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( APPEARANCE_CONTROLS_3D_BASE::onLayerPresetChanged ), NULL, this );
m_cbViewports->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( APPEARANCE_CONTROLS_3D_BASE::onViewportChanged ), NULL, this );
m_cbViewports->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( APPEARANCE_CONTROLS_3D_BASE::onUpdateViewportsCb ), NULL, this );
}
APPEARANCE_CONTROLS_3D_BASE::~APPEARANCE_CONTROLS_3D_BASE()
{
// Disconnect Events
this->Disconnect( wxEVT_SET_FOCUS, wxFocusEventHandler( APPEARANCE_CONTROLS_3D_BASE::OnSetFocus ) );
this->Disconnect( wxEVT_SIZE, wxSizeEventHandler( APPEARANCE_CONTROLS_3D_BASE::OnSize ) );
m_panelLayers->Disconnect( wxEVT_SET_FOCUS, wxFocusEventHandler( APPEARANCE_CONTROLS_3D_BASE::OnSetFocus ), NULL, this );
m_cbLayerPresets->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( APPEARANCE_CONTROLS_3D_BASE::onLayerPresetChanged ), NULL, this );
m_cbViewports->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( APPEARANCE_CONTROLS_3D_BASE::onViewportChanged ), NULL, this );
m_cbViewports->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( APPEARANCE_CONTROLS_3D_BASE::onUpdateViewportsCb ), NULL, this );
}
@@ -1,553 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<wxFormBuilder_Project>
<FileVersion major="1" minor="17"/>
<object class="Project" expanded="true">
<property name="class_decoration">; </property>
<property name="code_generation">C++</property>
<property name="disconnect_events">1</property>
<property name="disconnect_mode">source_name</property>
<property name="disconnect_php_events">0</property>
<property name="disconnect_python_events">0</property>
<property name="embedded_files_path">res</property>
<property name="encoding">UTF-8</property>
<property name="event_generation">connect</property>
<property name="file">appearance_controls_3D_base</property>
<property name="first_id">1000</property>
<property name="help_provider">none</property>
<property name="image_path_wrapper_function_name"></property>
<property name="indent_with_spaces"></property>
<property name="internationalize">1</property>
<property name="name">Appearance Panel 3D</property>
<property name="namespace"></property>
<property name="path">.</property>
<property name="precompiled_header"></property>
<property name="relative_path">1</property>
<property name="skip_lua_events">1</property>
<property name="skip_php_events">1</property>
<property name="skip_python_events">1</property>
<property name="ui_table">UI</property>
<property name="use_array_enum">0</property>
<property name="use_enum">0</property>
<property name="use_microsoft_bom">0</property>
<object class="Panel" expanded="true">
<property name="aui_managed">0</property>
<property name="aui_manager_style">wxAUI_MGR_DEFAULT</property>
<property name="bg"></property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="event_handler">impl_virtual</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="minimum_size">200,360</property>
<property name="name">APPEARANCE_CONTROLS_3D_BASE</property>
<property name="pos"></property>
<property name="size">-1,-1</property>
<property name="subclass">WX_PANEL; widgets/wx_panel.h; forward_declare</property>
<property name="tooltip"></property>
<property name="two_step_creation">0</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
<event name="OnSetFocus">OnSetFocus</event>
<event name="OnSize">OnSize</event>
<object class="wxBoxSizer" expanded="true">
<property name="minimum_size"></property>
<property name="name">m_sizerOuter</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">protected</property>
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxPanel" expanded="true">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_panelLayers</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
<event name="OnSetFocus">OnSetFocus</event>
<object class="wxBoxSizer" expanded="true">
<property name="minimum_size"></property>
<property name="name">m_panelLayersSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">protected</property>
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="CustomControl" expanded="true">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="class">wxScrolledCanvas</property>
<property name="close_button">1</property>
<property name="construction"></property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="declaration"></property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="include">#include &lt;wx/scrolwin.h&gt;&#x0A;#include &lt;wx/grid.h&gt; // needed for MSVC to see wxScrolledCanvas indirectly exported</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_windowLayers</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="settings"></property>
<property name="show">1</property>
<property name="size"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxVSCROLL</property>
</object>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="true">
<property name="border">2</property>
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="true">
<property name="minimum_size"></property>
<property name="name">bBottomMargin</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="true">
<property name="border">3</property>
<property name="flag">wxEXPAND|wxBOTTOM</property>
<property name="proportion">0</property>
<object class="wxStaticLine" expanded="true">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticline1</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxLI_HORIZONTAL</property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="true">
<property name="minimum_size"></property>
<property name="name">bPresets</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="false">
<property name="border">2</property>
<property name="flag">wxRIGHT|wxLEFT</property>
<property name="proportion">1</property>
<object class="wxStaticText" expanded="false">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Presets (Ctrl+Tab):</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_presetsLabel</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
</object>
</object>
<object class="sizeritem" expanded="false">
<property name="border">2</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxChoice" expanded="false">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="choices">&quot;Follow PCB Editor&quot; &quot;Follow PCB Plot Settings&quot;</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_cbLayerPresets</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="selection">1</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChoice">onLayerPresetChanged</event>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="false">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="spacer" expanded="false">
<property name="height">2</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="true">
<property name="minimum_size"></property>
<property name="name">bViewports</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="false">
<property name="border">2</property>
<property name="flag">wxRIGHT|wxLEFT</property>
<property name="proportion">1</property>
<object class="wxStaticText" expanded="false">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Viewports (Alt+Tab):</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_viewportsLabel</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
</object>
</object>
<object class="sizeritem" expanded="false">
<property name="border">2</property>
<property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxChoice" expanded="false">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="choices">&quot;(unsaved)&quot;</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_cbViewports</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="selection">1</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChoice">onViewportChanged</event>
<event name="OnUpdateUI">onUpdateViewportsCb</event>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
</wxFormBuilder_Project>
@@ -1,63 +0,0 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#pragma once
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include "widgets/wx_panel.h"
#include <wx/scrolwin.h>
#include <wx/grid.h> // needed for MSVC to see wxScrolledCanvas indirectly exported
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/string.h>
#include <wx/sizer.h>
#include <wx/panel.h>
#include <wx/statline.h>
#include <wx/stattext.h>
#include <wx/choice.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class APPEARANCE_CONTROLS_3D_BASE
///////////////////////////////////////////////////////////////////////////////
class APPEARANCE_CONTROLS_3D_BASE : public WX_PANEL
{
private:
protected:
wxBoxSizer* m_sizerOuter;
wxPanel* m_panelLayers;
wxBoxSizer* m_panelLayersSizer;
wxScrolledCanvas* m_windowLayers;
wxStaticLine* m_staticline1;
wxStaticText* m_presetsLabel;
wxChoice* m_cbLayerPresets;
wxStaticText* m_viewportsLabel;
wxChoice* m_cbViewports;
// Virtual event handlers, override them in your derived class
virtual void OnSetFocus( wxFocusEvent& event ) { event.Skip(); }
virtual void OnSize( wxSizeEvent& event ) { event.Skip(); }
virtual void onLayerPresetChanged( wxCommandEvent& event ) { event.Skip(); }
virtual void onViewportChanged( wxCommandEvent& event ) { event.Skip(); }
virtual void onUpdateViewportsCb( wxUpdateUIEvent& event ) { event.Skip(); }
public:
APPEARANCE_CONTROLS_3D_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
~APPEARANCE_CONTROLS_3D_BASE();
};
+127
View File
@@ -0,0 +1,127 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "panel_3D_colors.h"
#include <widgets/color_swatch.h>
#include <settings/settings_manager.h>
#include <pgm_base.h>
PANEL_3D_COLORS::PANEL_3D_COLORS( wxWindow* aParent ) :
PANEL_3D_COLORS_BASE( aParent )
{
m_backgroundTop->SetDefaultColor( BOARD_ADAPTER::g_DefaultBackgroundTop );
m_backgroundBottom->SetDefaultColor( BOARD_ADAPTER::g_DefaultBackgroundBot );
m_silkscreenTop->SetUserColors( &BOARD_ADAPTER::g_SilkscreenColors );
m_silkscreenTop->SetDefaultColor( BOARD_ADAPTER::g_DefaultSilkscreen );
m_silkscreenBottom->SetUserColors( &BOARD_ADAPTER::g_SilkscreenColors );
m_silkscreenBottom->SetDefaultColor( BOARD_ADAPTER::g_DefaultSilkscreen );
m_solderMaskTop->SetUserColors( &BOARD_ADAPTER::g_MaskColors );
m_solderMaskTop->SetDefaultColor( BOARD_ADAPTER::g_DefaultSolderMask );
m_solderMaskBottom->SetUserColors( &BOARD_ADAPTER::g_MaskColors );
m_solderMaskBottom->SetDefaultColor( BOARD_ADAPTER::g_DefaultSolderMask );
m_solderPaste->SetUserColors( &BOARD_ADAPTER::g_PasteColors );
m_solderPaste->SetDefaultColor( BOARD_ADAPTER::g_DefaultSolderPaste );
m_surfaceFinish->SetUserColors( &BOARD_ADAPTER::g_FinishColors );
m_surfaceFinish->SetDefaultColor( BOARD_ADAPTER::g_DefaultSurfaceFinish );
m_boardBody->SetUserColors( &BOARD_ADAPTER::g_BoardColors );
m_boardBody->SetDefaultColor( BOARD_ADAPTER::g_DefaultBoardBody );
}
bool PANEL_3D_COLORS::TransferDataToWindow()
{
COLOR_SETTINGS* colors = Pgm().GetSettingsManager().GetColorSettings();
m_backgroundTop->SetSupportsOpacity( false );
m_backgroundBottom->SetSupportsOpacity( false );
m_silkscreenTop->SetSupportsOpacity( false );
m_silkscreenBottom->SetSupportsOpacity( false );
m_solderMaskTop->SetBackgroundColour( *wxWHITE );
m_solderMaskBottom->SetBackgroundColour( *wxWHITE );
m_solderPaste->SetSupportsOpacity( false );
m_surfaceFinish->SetSupportsOpacity( false );
m_boardBody->SetBackgroundColour( *wxWHITE );
m_backgroundTop->SetSwatchColor( colors->GetColor( LAYER_3D_BACKGROUND_TOP ), false );
m_backgroundBottom->SetSwatchColor( colors->GetColor( LAYER_3D_BACKGROUND_BOTTOM ), false );
m_silkscreenTop->SetSwatchColor( colors->GetColor( LAYER_3D_SILKSCREEN_TOP ), false );
m_silkscreenBottom->SetSwatchColor( colors->GetColor( LAYER_3D_SILKSCREEN_BOTTOM ), false );
m_solderMaskTop->SetSwatchColor( colors->GetColor( LAYER_3D_SOLDERMASK_TOP ), false );
m_solderMaskBottom->SetSwatchColor( colors->GetColor( LAYER_3D_SOLDERMASK_BOTTOM ), false );
m_solderPaste->SetSwatchColor( colors->GetColor( LAYER_3D_SOLDERPASTE ), false );
m_surfaceFinish->SetSwatchColor( colors->GetColor( LAYER_3D_COPPER ), false );
m_boardBody->SetSwatchColor( colors->GetColor( LAYER_3D_BOARD ), false );
if( colors->GetUseBoardStackupColors() )
m_boardStackupRB->SetValue( true );
else
m_specificColorsRB->SetValue( true );
return true;
}
bool PANEL_3D_COLORS::TransferDataFromWindow()
{
COLOR_SETTINGS* colors = Pgm().GetSettingsManager().GetColorSettings();
colors->SetColor( LAYER_3D_BACKGROUND_TOP, m_backgroundTop->GetSwatchColor() );
colors->SetColor( LAYER_3D_BACKGROUND_BOTTOM, m_backgroundBottom->GetSwatchColor() );
colors->SetColor( LAYER_3D_SILKSCREEN_TOP, m_silkscreenTop->GetSwatchColor() );
colors->SetColor( LAYER_3D_SILKSCREEN_BOTTOM, m_silkscreenBottom->GetSwatchColor() );
colors->SetColor( LAYER_3D_SOLDERMASK_TOP, m_solderMaskTop->GetSwatchColor() );
colors->SetColor( LAYER_3D_SOLDERMASK_BOTTOM, m_solderMaskBottom->GetSwatchColor() );
colors->SetColor( LAYER_3D_SOLDERPASTE, m_solderPaste->GetSwatchColor() );
colors->SetColor( LAYER_3D_COPPER, m_surfaceFinish->GetSwatchColor() );
colors->SetColor( LAYER_3D_BOARD, m_boardBody->GetSwatchColor() );
colors->SetUseBoardStackupColors( m_boardStackupRB->GetValue() );
Pgm().GetSettingsManager().SaveColorSettings( colors, "3d_viewer" );
return true;
}
void PANEL_3D_COLORS::ResetPanel()
{
COLOR_SETTINGS* colors = Pgm().GetSettingsManager().GetColorSettings();
m_backgroundTop->SetSwatchColor( colors->GetDefaultColor( LAYER_3D_BACKGROUND_TOP ), false );
m_backgroundBottom->SetSwatchColor( colors->GetDefaultColor( LAYER_3D_BACKGROUND_BOTTOM ), false );
m_silkscreenTop->SetSwatchColor( colors->GetDefaultColor( LAYER_3D_SILKSCREEN_TOP ), false );
m_silkscreenBottom->SetSwatchColor( colors->GetDefaultColor( LAYER_3D_SILKSCREEN_BOTTOM ), false );
m_solderMaskTop->SetSwatchColor( colors->GetDefaultColor( LAYER_3D_SOLDERMASK_TOP ), false );
m_solderMaskBottom->SetSwatchColor( colors->GetDefaultColor( LAYER_3D_SOLDERMASK_BOTTOM ), false );
m_solderPaste->SetSwatchColor( colors->GetDefaultColor( LAYER_3D_SOLDERPASTE ), false );
m_surfaceFinish->SetSwatchColor( colors->GetDefaultColor( LAYER_3D_COPPER ), false );
m_boardBody->SetSwatchColor( colors->GetDefaultColor( LAYER_3D_BOARD ), false );
m_boardStackupRB->SetValue( true );
}
+42
View File
@@ -0,0 +1,42 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef PANEL_3D_COLORS_H
#define PANEL_3D_COLORS_H
#include "panel_3D_colors_base.h"
#include <3d_viewer/eda_3d_viewer_frame.h>
class PANEL_3D_COLORS : public PANEL_3D_COLORS_BASE
{
public:
explicit PANEL_3D_COLORS( wxWindow* aParent );
bool TransferDataFromWindow() override;
bool TransferDataToWindow() override;
void ResetPanel() override;
};
#endif // PANEL_3D_COLORS_H
+153
View File
@@ -0,0 +1,153 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "widgets/color_swatch.h"
#include "panel_3D_colors_base.h"
///////////////////////////////////////////////////////////////////////////
PANEL_3D_COLORS_BASE::PANEL_3D_COLORS_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : RESETTABLE_PANEL( parent, id, pos, size, style, name )
{
wxBoxSizer* bSizerMain;
bSizerMain = new wxBoxSizer( wxVERTICAL );
m_environmentLable = new wxStaticText( this, wxID_ANY, _("Environment Colors"), wxDefaultPosition, wxDefaultSize, 0 );
m_environmentLable->Wrap( -1 );
bSizerMain->Add( m_environmentLable, 0, wxTOP|wxRIGHT|wxLEFT|wxEXPAND, 13 );
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bSizerMain->Add( m_staticline1, 0, wxEXPAND|wxBOTTOM, 5 );
wxFlexGridSizer* fgSizer1;
fgSizer1 = new wxFlexGridSizer( 0, 2, 5, 0 );
fgSizer1->SetFlexibleDirection( wxBOTH );
fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
backgroundTopLabel = new wxStaticText( this, wxID_ANY, _("Background gradient start:"), wxDefaultPosition, wxDefaultSize, 0 );
backgroundTopLabel->Wrap( -1 );
fgSizer1->Add( backgroundTopLabel, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
m_backgroundTop = new COLOR_SWATCH( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer1->Add( m_backgroundTop, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
backgroundBotLabel = new wxStaticText( this, wxID_ANY, _("Background gradient end:"), wxDefaultPosition, wxDefaultSize, 0 );
backgroundBotLabel->Wrap( -1 );
fgSizer1->Add( backgroundBotLabel, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
m_backgroundBottom = new COLOR_SWATCH( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer1->Add( m_backgroundBottom, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
fgSizer1->Add( 0, 6, 1, wxEXPAND, 5 );
fgSizer1->Add( 0, 0, 1, wxEXPAND, 5 );
solderPasteLabel = new wxStaticText( this, wxID_ANY, _("Solder paste:"), wxDefaultPosition, wxDefaultSize, 0 );
solderPasteLabel->Wrap( -1 );
fgSizer1->Add( solderPasteLabel, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
m_solderPaste = new COLOR_SWATCH( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer1->Add( m_solderPaste, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
bSizerMain->Add( fgSizer1, 0, wxTOP|wxBOTTOM|wxLEFT, 5 );
bSizerMain->Add( 0, 15, 0, wxEXPAND, 5 );
m_boardColorsLabel = new wxStaticText( this, wxID_ANY, _("Board Colors"), wxDefaultPosition, wxDefaultSize, 0 );
m_boardColorsLabel->Wrap( -1 );
bSizerMain->Add( m_boardColorsLabel, 0, wxTOP|wxRIGHT|wxLEFT|wxEXPAND, 13 );
m_staticline2 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bSizerMain->Add( m_staticline2, 0, wxEXPAND|wxBOTTOM, 5 );
m_boardStackupRB = new wxRadioButton( this, wxID_ANY, _("Use board stackup colors"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerMain->Add( m_boardStackupRB, 0, wxTOP|wxBOTTOM|wxLEFT, 8 );
m_specificColorsRB = new wxRadioButton( this, wxID_ANY, _("Use colors:"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerMain->Add( m_specificColorsRB, 0, wxTOP|wxBOTTOM|wxLEFT, 8 );
wxFlexGridSizer* fgSizer2;
fgSizer2 = new wxFlexGridSizer( 0, 2, 5, 0 );
fgSizer2->SetFlexibleDirection( wxBOTH );
fgSizer2->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
silkscreenTopLabel = new wxStaticText( this, wxID_ANY, _("Silkscreen top:"), wxDefaultPosition, wxDefaultSize, 0 );
silkscreenTopLabel->Wrap( -1 );
fgSizer2->Add( silkscreenTopLabel, 0, wxLEFT|wxALIGN_CENTER_VERTICAL, 20 );
m_silkscreenTop = new COLOR_SWATCH( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer2->Add( m_silkscreenTop, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
silkscreenBottomLabel = new wxStaticText( this, wxID_ANY, _("Silkscreen bottom:"), wxDefaultPosition, wxDefaultSize, 0 );
silkscreenBottomLabel->Wrap( -1 );
fgSizer2->Add( silkscreenBottomLabel, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 20 );
m_silkscreenBottom = new COLOR_SWATCH( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer2->Add( m_silkscreenBottom, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
fgSizer2->Add( 0, 6, 1, wxEXPAND, 5 );
fgSizer2->Add( 0, 0, 1, wxEXPAND, 5 );
solderMaskTopLabel = new wxStaticText( this, wxID_ANY, _("Solder mask top:"), wxDefaultPosition, wxDefaultSize, 0 );
solderMaskTopLabel->Wrap( -1 );
fgSizer2->Add( solderMaskTopLabel, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 20 );
m_solderMaskTop = new COLOR_SWATCH( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer2->Add( m_solderMaskTop, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
solderMaskBottomLabel = new wxStaticText( this, wxID_ANY, _("Solder mask bottom:"), wxDefaultPosition, wxDefaultSize, 0 );
solderMaskBottomLabel->Wrap( -1 );
fgSizer2->Add( solderMaskBottomLabel, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 20 );
m_solderMaskBottom = new COLOR_SWATCH( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer2->Add( m_solderMaskBottom, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
fgSizer2->Add( 0, 6, 1, wxEXPAND, 5 );
fgSizer2->Add( 0, 0, 1, wxEXPAND, 5 );
surfaceFinishLabel = new wxStaticText( this, wxID_ANY, _("Copper/surface finish:"), wxDefaultPosition, wxDefaultSize, 0 );
surfaceFinishLabel->Wrap( -1 );
fgSizer2->Add( surfaceFinishLabel, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 20 );
m_surfaceFinish = new COLOR_SWATCH( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer2->Add( m_surfaceFinish, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
fgSizer2->Add( 0, 6, 1, wxEXPAND, 5 );
fgSizer2->Add( 0, 0, 1, wxEXPAND, 5 );
boardBodyLabel = new wxStaticText( this, wxID_ANY, _("Board body:"), wxDefaultPosition, wxDefaultSize, 0 );
boardBodyLabel->Wrap( -1 );
fgSizer2->Add( boardBodyLabel, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 20 );
m_boardBody = new COLOR_SWATCH( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer2->Add( m_boardBody, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT, 5 );
bSizerMain->Add( fgSizer2, 1, wxEXPAND|wxLEFT, 8 );
this->SetSizer( bSizerMain );
this->Layout();
bSizerMain->Fit( this );
}
PANEL_3D_COLORS_BASE::~PANEL_3D_COLORS_BASE()
{
}
File diff suppressed because it is too large Load Diff
+70
View File
@@ -0,0 +1,70 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#pragma once
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
class COLOR_SWATCH;
#include "widgets/resettable_panel.h"
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/statline.h>
#include <wx/sizer.h>
#include <wx/radiobut.h>
#include <wx/panel.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class PANEL_3D_COLORS_BASE
///////////////////////////////////////////////////////////////////////////////
class PANEL_3D_COLORS_BASE : public RESETTABLE_PANEL
{
private:
protected:
wxStaticText* m_environmentLable;
wxStaticLine* m_staticline1;
wxStaticText* backgroundTopLabel;
COLOR_SWATCH* m_backgroundTop;
wxStaticText* backgroundBotLabel;
COLOR_SWATCH* m_backgroundBottom;
wxStaticText* solderPasteLabel;
COLOR_SWATCH* m_solderPaste;
wxStaticText* m_boardColorsLabel;
wxStaticLine* m_staticline2;
wxRadioButton* m_boardStackupRB;
wxRadioButton* m_specificColorsRB;
wxStaticText* silkscreenTopLabel;
COLOR_SWATCH* m_silkscreenTop;
wxStaticText* silkscreenBottomLabel;
COLOR_SWATCH* m_silkscreenBottom;
wxStaticText* solderMaskTopLabel;
COLOR_SWATCH* m_solderMaskTop;
wxStaticText* solderMaskBottomLabel;
COLOR_SWATCH* m_solderMaskBottom;
wxStaticText* surfaceFinishLabel;
COLOR_SWATCH* m_surfaceFinish;
wxStaticText* boardBodyLabel;
COLOR_SWATCH* m_boardBody;
public:
PANEL_3D_COLORS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
~PANEL_3D_COLORS_BASE();
};
+24 -5
View File
@@ -45,11 +45,18 @@ void PANEL_3D_DISPLAY_OPTIONS::OnCheckEnableAnimation( wxCommandEvent& event )
void PANEL_3D_DISPLAY_OPTIONS::loadViewSettings( EDA_3D_VIEWER_SETTINGS* aCfg )
{
// Check/uncheck checkboxes
m_checkBoxRealisticMode->SetValue( aCfg->m_Render.realistic );
m_checkBoxBoardBody->SetValue( aCfg->m_Render.show_board_body );
m_checkBoxAreas->SetValue( aCfg->m_Render.show_zones );
m_checkBoxSilkscreen->SetValue( aCfg->m_Render.show_silkscreen );
m_checkBoxSolderMask->SetValue( aCfg->m_Render.show_soldermask );
m_checkBoxSolderpaste->SetValue( aCfg->m_Render.show_solderpaste );
m_checkBoxAdhesive->SetValue( aCfg->m_Render.show_adhesive );
m_checkBoxComments->SetValue( aCfg->m_Render.show_comments );
m_checkBoxECO->SetValue( aCfg->m_Render.show_eco );
m_checkBoxSubtractMaskFromSilk->SetValue( aCfg->m_Render.subtract_mask_from_silk );
m_checkBoxClipSilkOnViaAnnulus->SetValue( aCfg->m_Render.clip_silk_on_via_annuli );
m_checkBoxRenderPlatedPadsAsPlated->SetValue( aCfg->m_Render.differentiate_plated_copper );
m_checkBoxClipSilkOnViaAnnulus->SetValue( aCfg->m_Render.clip_silk_on_via_annulus );
m_checkBoxRenderPlatedPadsAsPlated->SetValue( aCfg->m_Render.renderPlatedPadsAsPlated );
m_materialProperties->SetSelection( static_cast<int>( aCfg->m_Render.material_mode ) );
@@ -76,14 +83,26 @@ bool PANEL_3D_DISPLAY_OPTIONS::TransferDataFromWindow()
{
EDA_3D_VIEWER_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<EDA_3D_VIEWER_SETTINGS>();
// Set render mode
cfg->m_Render.realistic = m_checkBoxRealisticMode->GetValue();
// Set visibility of items
cfg->m_Render.show_board_body = m_checkBoxBoardBody->GetValue();
cfg->m_Render.show_zones = m_checkBoxAreas->GetValue();
cfg->m_Render.subtract_mask_from_silk = m_checkBoxSubtractMaskFromSilk->GetValue();
cfg->m_Render.clip_silk_on_via_annuli = m_checkBoxClipSilkOnViaAnnulus->GetValue();
cfg->m_Render.differentiate_plated_copper = m_checkBoxRenderPlatedPadsAsPlated->GetValue();
cfg->m_Render.clip_silk_on_via_annulus = m_checkBoxClipSilkOnViaAnnulus->GetValue();
cfg->m_Render.renderPlatedPadsAsPlated = m_checkBoxRenderPlatedPadsAsPlated->GetValue();
cfg->m_Render.material_mode = static_cast<MATERIAL_MODE>( m_materialProperties->GetSelection() );
// Set Layer visibility
cfg->m_Render.show_silkscreen = m_checkBoxSilkscreen->GetValue();
cfg->m_Render.show_soldermask = m_checkBoxSolderMask->GetValue();
cfg->m_Render.show_solderpaste = m_checkBoxSolderpaste->GetValue();
cfg->m_Render.show_adhesive = m_checkBoxAdhesive->GetValue();
cfg->m_Render.show_comments = m_checkBoxComments->GetValue();
cfg->m_Render.show_eco = m_checkBoxECO->GetValue( );
// Camera Options
cfg->m_Camera.animation_enabled = m_checkBoxEnableAnimation->GetValue();
cfg->m_Camera.moving_speed_multiplier = m_sliderAnimationSpeed->GetValue();
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
// C++ code generated with wxFormBuilder (version 3.10.0-39-g3487c3cb)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@@ -15,11 +15,69 @@ PANEL_3D_DISPLAY_OPTIONS_BASE::PANEL_3D_DISPLAY_OPTIONS_BASE( wxWindow* parent,
bSizerMain = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bSizer7;
bSizer7 = new wxBoxSizer( wxVERTICAL );
bSizer7 = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bSizeLeft;
bSizeLeft = new wxBoxSizer( wxVERTICAL );
m_boardLayersLabel = new wxStaticText( this, wxID_ANY, _("Board Layers"), wxDefaultPosition, wxDefaultSize, 0 );
m_boardLayersLabel->Wrap( -1 );
bSizeLeft->Add( m_boardLayersLabel, 0, wxTOP|wxRIGHT|wxLEFT|wxEXPAND, 13 );
m_staticline2 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bSizeLeft->Add( m_staticline2, 0, wxEXPAND|wxBOTTOM, 5 );
wxFlexGridSizer* fgSizer1;
fgSizer1 = new wxFlexGridSizer( 0, 1, 4, 0 );
fgSizer1->SetFlexibleDirection( wxBOTH );
fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_checkBoxSilkscreen = new wxCheckBox( this, wxID_ANY, _("Show silkscreen layers"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizer1->Add( m_checkBoxSilkscreen, 0, wxLEFT, 5 );
m_checkBoxSubtractMaskFromSilk = new wxCheckBox( this, wxID_ANY, _("Clip silkscreen at solder mask edges"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizer1->Add( m_checkBoxSubtractMaskFromSilk, 0, wxLEFT, 25 );
m_checkBoxClipSilkOnViaAnnulus = new wxCheckBox( this, wxID_ANY, _("Clip silkscreen at via annuli"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizer1->Add( m_checkBoxClipSilkOnViaAnnulus, 0, wxLEFT, 25 );
m_checkBoxSolderMask = new wxCheckBox( this, wxID_ANY, _("Show solder mask layers"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizer1->Add( m_checkBoxSolderMask, 0, wxTOP|wxLEFT, 5 );
m_checkBoxSolderpaste = new wxCheckBox( this, wxID_ANY, _("Show solder paste layers"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizer1->Add( m_checkBoxSolderpaste, 0, wxLEFT, 5 );
m_checkBoxAdhesive = new wxCheckBox( this, wxID_ANY, _("Show adhesive layers"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizer1->Add( m_checkBoxAdhesive, 0, wxLEFT, 5 );
bSizeLeft->Add( fgSizer1, 0, wxEXPAND|wxALL, 5 );
bSizeLeft->Add( 0, 15, 0, wxEXPAND, 5 );
m_userLayersLabel = new wxStaticText( this, wxID_ANY, _("User Layers (not shown in realistic mode)"), wxDefaultPosition, wxDefaultSize, 0 );
m_userLayersLabel->Wrap( -1 );
bSizeLeft->Add( m_userLayersLabel, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 13 );
m_staticline31 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bSizeLeft->Add( m_staticline31, 0, wxEXPAND|wxBOTTOM, 5 );
bSizeLeft->Add( 0, 5, 0, wxEXPAND, 5 );
m_checkBoxComments = new wxCheckBox( this, wxID_ANY, _("Show comment and drawing layers"), wxDefaultPosition, wxDefaultSize, 0 );
bSizeLeft->Add( m_checkBoxComments, 0, wxRIGHT|wxLEFT, 10 );
bSizeLeft->Add( 0, 4, 0, wxEXPAND, 5 );
m_checkBoxECO = new wxCheckBox( this, wxID_ANY, _("Show ECO layers"), wxDefaultPosition, wxDefaultSize, 0 );
bSizeLeft->Add( m_checkBoxECO, 0, wxRIGHT|wxLEFT, 10 );
bSizeLeft->Add( 0, 15, 0, wxEXPAND, 5 );
m_renderOptionsLabel = new wxStaticText( this, wxID_ANY, _("Render Options"), wxDefaultPosition, wxDefaultSize, 0 );
m_renderOptionsLabel->Wrap( -1 );
bSizeLeft->Add( m_renderOptionsLabel, 0, wxTOP|wxRIGHT|wxLEFT|wxEXPAND, 13 );
@@ -28,20 +86,20 @@ PANEL_3D_DISPLAY_OPTIONS_BASE::PANEL_3D_DISPLAY_OPTIONS_BASE( wxWindow* parent,
bSizeLeft->Add( m_staticline4, 0, wxEXPAND|wxBOTTOM, 5 );
wxFlexGridSizer* fgSizer2;
fgSizer2 = new wxFlexGridSizer( 0, 1, 5, 0 );
fgSizer2 = new wxFlexGridSizer( 0, 1, 4, 0 );
fgSizer2->SetFlexibleDirection( wxBOTH );
fgSizer2->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_checkBoxClipSilkOnViaAnnulus = new wxCheckBox( this, wxID_ANY, _("Clip silkscreen at via annuli"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizer2->Add( m_checkBoxClipSilkOnViaAnnulus, 0, wxLEFT, 5 );
m_checkBoxBoardBody = new wxCheckBox( this, wxID_ANY, _("Show board body"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizer2->Add( m_checkBoxBoardBody, 0, wxRIGHT|wxLEFT, 5 );
m_checkBoxSubtractMaskFromSilk = new wxCheckBox( this, wxID_ANY, _("Clip silkscreen at solder mask edges"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizer2->Add( m_checkBoxSubtractMaskFromSilk, 0, wxLEFT, 5 );
m_checkBoxRealisticMode = new wxCheckBox( this, wxID_ANY, _("Realistic mode"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizer2->Add( m_checkBoxRealisticMode, 0, wxRIGHT|wxLEFT, 5 );
m_checkBoxAreas = new wxCheckBox( this, wxID_ANY, _("Show filled areas in zones"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizer2->Add( m_checkBoxAreas, 0, wxRIGHT|wxLEFT, 5 );
m_checkBoxRenderPlatedPadsAsPlated = new wxCheckBox( this, wxID_ANY, _("Use bare copper color for unplated copper (slow)"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkBoxRenderPlatedPadsAsPlated = new wxCheckBox( this, wxID_ANY, _("Use bare copper color for unplated copper"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkBoxRenderPlatedPadsAsPlated->SetToolTip( _("Use different colors for plated and unplated copper. (Slow)") );
fgSizer2->Add( m_checkBoxRenderPlatedPadsAsPlated, 0, wxRIGHT|wxLEFT, 5 );
@@ -94,27 +152,35 @@ PANEL_3D_DISPLAY_OPTIONS_BASE::PANEL_3D_DISPLAY_OPTIONS_BASE( wxWindow* parent,
bSizerRotAngle->Add( m_staticTextRotAngleUnits, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
bSizerRight->Add( bSizerRotAngle, 0, wxTOP|wxLEFT, 5 );
bSizerRight->Add( bSizerRotAngle, 0, wxTOP|wxBOTTOM|wxLEFT, 5 );
wxBoxSizer* bSizer9;
bSizer9 = new wxBoxSizer( wxVERTICAL );
m_checkBoxEnableAnimation = new wxCheckBox( this, wxID_ANY, _("Enable animation"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkBoxEnableAnimation->SetValue(true);
bSizer9->Add( m_checkBoxEnableAnimation, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
bSizerRight->Add( bSizer9, 0, wxEXPAND|wxLEFT, 5 );
wxBoxSizer* bSizerSlider;
bSizerSlider = new wxBoxSizer( wxHORIZONTAL );
m_checkBoxEnableAnimation = new wxCheckBox( this, wxID_ANY, _("Redraw while moving"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkBoxEnableAnimation->SetValue(true);
bSizerSlider->Add( m_checkBoxEnableAnimation, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
m_staticAnimationSpeed = new wxStaticText( this, wxID_ANY, _("Redraw speed:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticAnimationSpeed = new wxStaticText( this, wxID_ANY, _("Animation speed:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticAnimationSpeed->Wrap( -1 );
bSizerSlider->Add( m_staticAnimationSpeed, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 15 );
bSizerSlider->Add( m_staticAnimationSpeed, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
m_sliderAnimationSpeed = new wxSlider( this, wxID_ANY, 3, 1, 5, wxDefaultPosition, wxDefaultSize, wxSL_AUTOTICKS|wxSL_HORIZONTAL|wxSL_LABELS );
bSizerSlider->Add( m_sliderAnimationSpeed, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
m_sliderAnimationSpeed->SetMinSize( wxSize( 100,-1 ) );
bSizerSlider->Add( m_sliderAnimationSpeed, 1, wxEXPAND|wxLEFT|wxRIGHT, 15 );
bSizerRight->Add( bSizerSlider, 0, wxEXPAND|wxLEFT, 5 );
bSizer7->Add( bSizerRight, 0, wxEXPAND|wxTOP, 15 );
bSizer7->Add( bSizerRight, 0, wxEXPAND, 15 );
bSizerMain->Add( bSizer7, 1, 0, 5 );
@@ -125,12 +191,14 @@ PANEL_3D_DISPLAY_OPTIONS_BASE::PANEL_3D_DISPLAY_OPTIONS_BASE( wxWindow* parent,
bSizerMain->Fit( this );
// Connect Events
m_checkBoxRealisticMode->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_3D_DISPLAY_OPTIONS_BASE::OnCheckRealisticMode ), NULL, this );
m_checkBoxEnableAnimation->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_3D_DISPLAY_OPTIONS_BASE::OnCheckEnableAnimation ), NULL, this );
}
PANEL_3D_DISPLAY_OPTIONS_BASE::~PANEL_3D_DISPLAY_OPTIONS_BASE()
{
// Disconnect Events
m_checkBoxRealisticMode->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_3D_DISPLAY_OPTIONS_BASE::OnCheckRealisticMode ), NULL, this );
m_checkBoxEnableAnimation->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_3D_DISPLAY_OPTIONS_BASE::OnCheckEnableAnimation ), NULL, this );
}
@@ -64,7 +64,7 @@
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizer7</property>
<property name="orient">wxVERTICAL</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">20</property>
@@ -75,6 +75,814 @@
<property name="name">bSizeLeft</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">13</property>
<property name="flag">wxTOP|wxRIGHT|wxLEFT|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Board Layers</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_boardLayersLabel</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxBOTTOM</property>
<property name="proportion">0</property>
<object class="wxStaticLine" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticline2</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxLI_HORIZONTAL</property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxALL</property>
<property name="proportion">0</property>
<object class="wxFlexGridSizer" expanded="1">
<property name="cols">1</property>
<property name="flexible_direction">wxBOTH</property>
<property name="growablecols"></property>
<property name="growablerows"></property>
<property name="hgap">0</property>
<property name="minimum_size"></property>
<property name="name">fgSizer1</property>
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property>
<property name="permission">none</property>
<property name="rows">0</property>
<property name="vgap">4</property>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxLEFT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Show silkscreen layers</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_checkBoxSilkscreen</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">25</property>
<property name="flag">wxLEFT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Clip silkscreen at solder mask edges</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_checkBoxSubtractMaskFromSilk</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">25</property>
<property name="flag">wxLEFT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Clip silkscreen at via annuli</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_checkBoxClipSilkOnViaAnnulus</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxTOP|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Show solder mask layers</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_checkBoxSolderMask</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxLEFT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Show solder paste layers</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_checkBoxSolderpaste</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxLEFT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Show adhesive layers</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_checkBoxAdhesive</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="spacer" expanded="1">
<property name="height">15</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">13</property>
<property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">User Layers (not shown in realistic mode)</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_userLayersLabel</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxBOTTOM</property>
<property name="proportion">0</property>
<object class="wxStaticLine" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticline31</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxLI_HORIZONTAL</property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="spacer" expanded="1">
<property name="height">5</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">10</property>
<property name="flag">wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Show comment and drawing layers</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_checkBoxComments</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="spacer" expanded="1">
<property name="height">4</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">10</property>
<property name="flag">wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Show ECO layers</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_checkBoxECO</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="spacer" expanded="1">
<property name="height">15</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">13</property>
<property name="flag">wxTOP|wxRIGHT|wxLEFT|wxEXPAND</property>
@@ -209,10 +1017,10 @@
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property>
<property name="permission">none</property>
<property name="rows">0</property>
<property name="vgap">5</property>
<property name="vgap">4</property>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxLEFT</property>
<property name="flag">wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="0">
<property name="BottomDockable">1</property>
@@ -243,7 +1051,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Clip silkscreen at via annuli</property>
<property name="label">Show board body</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@@ -251,7 +1059,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_checkBoxClipSilkOnViaAnnulus</property>
<property name="name">m_checkBoxBoardBody</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
@@ -276,7 +1084,7 @@
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxLEFT</property>
<property name="flag">wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="0">
<property name="BottomDockable">1</property>
@@ -307,7 +1115,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Clip silkscreen at solder mask edges</property>
<property name="label">Realistic mode</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@@ -315,7 +1123,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_checkBoxSubtractMaskFromSilk</property>
<property name="name">m_checkBoxRealisticMode</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
@@ -336,6 +1144,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnCheckBox">OnCheckRealisticMode</event>
</object>
</object>
<object class="sizeritem" expanded="0">
@@ -435,7 +1244,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Use bare copper color for unplated copper (slow)</property>
<property name="label">Use bare copper color for unplated copper</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@@ -608,7 +1417,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">15</property>
<property name="flag">wxEXPAND|wxTOP</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
@@ -734,11 +1543,11 @@
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxTOP|wxLEFT</property>
<property name="flag">wxTOP|wxBOTTOM|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<object class="wxBoxSizer" expanded="0">
<property name="minimum_size"></property>
<property name="name">bSizerRotAngle</property>
<property name="orient">wxHORIZONTAL</property>
@@ -937,12 +1746,12 @@
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizerSlider</property>
<property name="orient">wxHORIZONTAL</property>
<property name="name">bSizer9</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT</property>
<property name="flag">wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="0">
<property name="BottomDockable">1</property>
@@ -973,7 +1782,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Redraw while moving</property>
<property name="label">Enable animation</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@@ -1005,8 +1814,19 @@
<event name="OnCheckBox">OnCheckEnableAnimation</event>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizerSlider</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="0">
<property name="border">15</property>
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="0">
@@ -1037,7 +1857,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Redraw speed:</property>
<property name="label">Animation speed:</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@@ -1067,9 +1887,9 @@
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<property name="border">15</property>
<property name="flag">wxEXPAND|wxLEFT|wxRIGHT</property>
<property name="proportion">1</property>
<object class="wxSlider" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
@@ -1105,7 +1925,7 @@
<property name="minValue">1</property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size">-1,-1</property>
<property name="minimum_size">100,-1</property>
<property name="moveable">1</property>
<property name="name">m_sliderAnimationSpeed</property>
<property name="pane_border">1</property>
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
// C++ code generated with wxFormBuilder (version 3.10.0-39-g3487c3cb)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@@ -19,8 +19,8 @@
#include <wx/settings.h>
#include <wx/statline.h>
#include <wx/checkbox.h>
#include <wx/choice.h>
#include <wx/sizer.h>
#include <wx/choice.h>
#include <wx/spinctrl.h>
#include <wx/slider.h>
#include <wx/panel.h>
@@ -36,10 +36,22 @@ class PANEL_3D_DISPLAY_OPTIONS_BASE : public RESETTABLE_PANEL
private:
protected:
wxStaticText* m_boardLayersLabel;
wxStaticLine* m_staticline2;
wxCheckBox* m_checkBoxSilkscreen;
wxCheckBox* m_checkBoxSubtractMaskFromSilk;
wxCheckBox* m_checkBoxClipSilkOnViaAnnulus;
wxCheckBox* m_checkBoxSolderMask;
wxCheckBox* m_checkBoxSolderpaste;
wxCheckBox* m_checkBoxAdhesive;
wxStaticText* m_userLayersLabel;
wxStaticLine* m_staticline31;
wxCheckBox* m_checkBoxComments;
wxCheckBox* m_checkBoxECO;
wxStaticText* m_renderOptionsLabel;
wxStaticLine* m_staticline4;
wxCheckBox* m_checkBoxClipSilkOnViaAnnulus;
wxCheckBox* m_checkBoxSubtractMaskFromSilk;
wxCheckBox* m_checkBoxBoardBody;
wxCheckBox* m_checkBoxRealisticMode;
wxCheckBox* m_checkBoxAreas;
wxCheckBox* m_checkBoxRenderPlatedPadsAsPlated;
wxStaticText* m_materialPropertiesLabel;
@@ -54,6 +66,7 @@ class PANEL_3D_DISPLAY_OPTIONS_BASE : public RESETTABLE_PANEL
wxSlider* m_sliderAnimationSpeed;
// Virtual event handlers, override them in your derived class
virtual void OnCheckRealisticMode( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCheckEnableAnimation( wxCommandEvent& event ) { event.Skip(); }
@@ -41,8 +41,8 @@ PANEL_3D_OPENGL_OPTIONS::PANEL_3D_OPENGL_OPTIONS( wxWindow* aParent ) :
void PANEL_3D_OPENGL_OPTIONS::loadSettings( EDA_3D_VIEWER_SETTINGS* aCfg )
{
m_checkBoxCuThickness->SetValue( aCfg->m_Render.opengl_copper_thickness );
m_checkBoxBoundingBoxes->SetValue( aCfg->m_Render.show_model_bbox );
m_checkBoxHighlightOnRollOver->SetValue( aCfg->m_Render.highlight_on_rollover );
m_checkBoxBoundingBoxes->SetValue( aCfg->m_Render.opengl_show_model_bbox );
m_checkBoxHighlightOnRollOver->SetValue( aCfg->m_Render.opengl_highlight_on_rollover );
m_choiceAntiAliasing->SetSelection( static_cast<int>( aCfg->m_Render.opengl_AA_mode ) );
m_selectionColorSwatch->SetSwatchColor( aCfg->m_Render.opengl_selection_color, false );
@@ -69,8 +69,8 @@ bool PANEL_3D_OPENGL_OPTIONS::TransferDataFromWindow()
EDA_3D_VIEWER_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<EDA_3D_VIEWER_SETTINGS>();
cfg->m_Render.opengl_copper_thickness = m_checkBoxCuThickness->GetValue();
cfg->m_Render.show_model_bbox = m_checkBoxBoundingBoxes->GetValue();
cfg->m_Render.highlight_on_rollover = m_checkBoxHighlightOnRollOver->GetValue();
cfg->m_Render.opengl_show_model_bbox = m_checkBoxBoundingBoxes->GetValue();
cfg->m_Render.opengl_highlight_on_rollover = m_checkBoxHighlightOnRollOver->GetValue();
cfg->m_Render.opengl_AA_mode = static_cast<ANTIALIASING_MODE>( m_choiceAntiAliasing->GetSelection() );
cfg->m_Render.opengl_selection_color = m_selectionColorSwatch->GetSwatchColor();
+43 -62
View File
@@ -4,7 +4,7 @@
* Copyright (C) 2016 Mario Luzeiro <mrluzeiro@ua.pt>
* Copyright (C) 2015 Cirilo Bernardo <cirilo.bernardo@gmail.com>
* Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2015-2023 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2015-2022 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -35,9 +35,8 @@
#include <bitmaps.h>
#include <board.h>
#include <common_ogl/ogl_attr_list.h>
#include <dpi_scaling_common.h>
#include <gal/dpi_scaling.h>
#include <pgm_base.h>
#include <project_pcb.h>
#include <settings/common_settings.h>
#include <settings/settings_manager.h>
#include <widgets/wx_infobar.h>
@@ -64,8 +63,6 @@ PANEL_PREVIEW_3D_MODEL::PANEL_PREVIEW_3D_MODEL( wxWindow* aParent, PCB_BASE_FRAM
// This board will only be used to hold a footprint for viewing
m_dummyBoard->SetBoardUse( BOARD_USE::FPHOLDER );
m_bodyStyleShowAll = true;
BOARD_DESIGN_SETTINGS parent_bds = aFrame->GetDesignSettings();
BOARD_DESIGN_SETTINGS& dummy_bds = m_dummyBoard->GetDesignSettings();
dummy_bds.SetBoardThickness( parent_bds.GetBoardThickness() );
@@ -79,16 +76,15 @@ PANEL_PREVIEW_3D_MODEL::PANEL_PREVIEW_3D_MODEL( wxWindow* aParent, PCB_BASE_FRAM
m_previewLabel->SetFont( KIUI::GetStatusFont( this ) );
// Set the bitmap of 3D view buttons:
m_bpvTop->SetBitmap( KiBitmapBundle( BITMAPS::axis3d_top ) );
m_bpvFront->SetBitmap( KiBitmapBundle( BITMAPS::axis3d_front ) );
m_bpvBack->SetBitmap( KiBitmapBundle( BITMAPS::axis3d_back ) );
m_bpvLeft->SetBitmap( KiBitmapBundle( BITMAPS::axis3d_left ) );
m_bpvRight->SetBitmap( KiBitmapBundle( BITMAPS::axis3d_right ) );
m_bpvBottom->SetBitmap( KiBitmapBundle( BITMAPS::axis3d_bottom ) );
m_bpvISO->SetBitmap( KiBitmapBundle( BITMAPS::ortho ) );
m_bpvBodyStyle->SetBitmap( KiBitmapBundle( BITMAPS::axis3d ) );
m_bpUpdate->SetBitmap( KiBitmapBundle( BITMAPS::reload ) );
m_bpSettings->SetBitmap( KiBitmapBundle( BITMAPS::options_3drender ) );
m_bpvTop->SetBitmap( KiBitmap( BITMAPS::axis3d_top ) );
m_bpvFront->SetBitmap( KiBitmap( BITMAPS::axis3d_front ) );
m_bpvBack->SetBitmap( KiBitmap( BITMAPS::axis3d_back ) );
m_bpvLeft->SetBitmap( KiBitmap( BITMAPS::axis3d_left ) );
m_bpvRight->SetBitmap( KiBitmap( BITMAPS::axis3d_right ) );
m_bpvBottom->SetBitmap( KiBitmap( BITMAPS::axis3d_bottom ) );
m_bpvISO->SetBitmap( KiBitmap( BITMAPS::ortho ) );
m_bpUpdate->SetBitmap( KiBitmap( BITMAPS::reload ) );
m_bpSettings->SetBitmap( KiBitmap( BITMAPS::options_3drender ) );
// Set the min and max values of spin buttons (mandatory on Linux)
// They are not used, so they are set to min and max 32 bits int values
@@ -123,7 +119,8 @@ PANEL_PREVIEW_3D_MODEL::PANEL_PREVIEW_3D_MODEL( wxWindow* aParent, PCB_BASE_FRAM
// Create the 3D canvas
m_previewPane = new EDA_3D_CANVAS( this,
OGL_ATT_LIST::GetAttributesList( ANTIALIASING_MODE::AA_8X ),
m_boardAdapter, m_currentCamera, PROJECT_PCB::Get3DCacheManager( &aFrame->Prj() ) );
m_boardAdapter, m_currentCamera,
aFrame->Prj().Get3DCacheManager() );
m_boardAdapter.SetBoard( m_dummyBoard );
m_boardAdapter.m_IsBoardView = false;
@@ -158,8 +155,7 @@ PANEL_PREVIEW_3D_MODEL::PANEL_PREVIEW_3D_MODEL( wxWindow* aParent, PCB_BASE_FRAM
this );
}
aFrame->Connect( EDA_EVT_UNITS_CHANGED,
wxCommandEventHandler( PANEL_PREVIEW_3D_MODEL::onUnitsChanged ),
aFrame->Connect( UNITS_CHANGED, wxCommandEventHandler( PANEL_PREVIEW_3D_MODEL::onUnitsChanged ),
nullptr, this );
#ifdef __WXOSX__
@@ -186,10 +182,6 @@ PANEL_PREVIEW_3D_MODEL::PANEL_PREVIEW_3D_MODEL( wxWindow* aParent, PCB_BASE_FRAM
PANEL_PREVIEW_3D_MODEL::~PANEL_PREVIEW_3D_MODEL()
{
// Restore the 3D viewer Render settings, that can be modified by the panel tools
if( m_boardAdapter.m_Cfg )
m_boardAdapter.m_Cfg->m_Render = m_initialRender;
delete m_dummyBoard;
delete m_previewPane;
}
@@ -210,33 +202,45 @@ void PANEL_PREVIEW_3D_MODEL::loadSettings()
COMMON_SETTINGS* settings = Pgm().GetCommonSettings();
const DPI_SCALING_COMMON dpi{ settings, this };
const DPI_SCALING dpi{ settings, this };
m_previewPane->SetScaleFactor( dpi.GetScaleFactor() );
// TODO(JE) use all control options
m_boardAdapter.m_MousewheelPanning = settings->m_Input.scroll_modifier_zoom != 0;
COLOR_SETTINGS* colors = Pgm().GetSettingsManager().GetColorSettings();
if( colors )
{
auto set =
[] ( const COLOR4D& aColor, SFVEC4F& aTarget )
{
aTarget.r = aColor.r;
aTarget.g = aColor.g;
aTarget.b = aColor.b;
aTarget.a = aColor.a;
};
set( colors->GetColor( LAYER_3D_BACKGROUND_BOTTOM ), m_boardAdapter.m_BgColorBot );
set( colors->GetColor( LAYER_3D_BACKGROUND_TOP ), m_boardAdapter.m_BgColorTop );
set( colors->GetColor( LAYER_3D_BOARD ), m_boardAdapter.m_BoardBodyColor );
set( colors->GetColor( LAYER_3D_COPPER ), m_boardAdapter.m_CopperColor );
set( colors->GetColor( LAYER_3D_SILKSCREEN_BOTTOM ), m_boardAdapter.m_SilkScreenColorBot );
set( colors->GetColor( LAYER_3D_SILKSCREEN_TOP ), m_boardAdapter.m_SilkScreenColorTop );
set( colors->GetColor( LAYER_3D_SOLDERMASK_BOTTOM ), m_boardAdapter.m_SolderMaskColorBot );
set( colors->GetColor( LAYER_3D_SOLDERMASK_TOP ), m_boardAdapter.m_SolderMaskColorTop );
set( colors->GetColor( LAYER_3D_SOLDERPASTE ), m_boardAdapter.m_SolderPasteColor );
}
EDA_3D_VIEWER_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<EDA_3D_VIEWER_SETTINGS>();
if( cfg )
{
// Save the 3D viewer render settings, to restore it after closing the preview
m_initialRender = cfg->m_Render;
m_boardAdapter.m_Cfg = cfg;
m_previewPane->SetAnimationEnabled( cfg->m_Camera.animation_enabled );
m_previewPane->SetMovingSpeedMultiplier( cfg->m_Camera.moving_speed_multiplier );
m_previewPane->SetProjectionMode( cfg->m_Camera.projection_mode );
// Ensure the board body is always shown, and do not use the settings of the 3D viewer
cfg->m_Render.show_copper_top = m_bodyStyleShowAll;
cfg->m_Render.show_copper_bottom = m_bodyStyleShowAll;
cfg->m_Render.show_soldermask_top = m_bodyStyleShowAll;
cfg->m_Render.show_soldermask_bottom = m_bodyStyleShowAll;
cfg->m_Render.show_solderpaste = m_bodyStyleShowAll;
cfg->m_Render.show_zones = m_bodyStyleShowAll;
cfg->m_Render.show_board_body = m_bodyStyleShowAll;
}
}
@@ -387,40 +391,18 @@ void PANEL_PREVIEW_3D_MODEL::onOpacitySlider( wxCommandEvent& event )
}
void PANEL_PREVIEW_3D_MODEL::setBodyStyleView( wxCommandEvent& event )
{
// turn ON or OFF options to show the board body if OFF, soder paste, soldermask
// and board body are hidden, to allows a good view of the 3D model and its pads.
EDA_3D_VIEWER_SETTINGS* cfg = m_boardAdapter.m_Cfg;
if( !cfg )
return;
m_bodyStyleShowAll = !m_bodyStyleShowAll;
cfg->m_Render.show_soldermask_top = m_bodyStyleShowAll;
cfg->m_Render.show_soldermask_bottom = m_bodyStyleShowAll;
cfg->m_Render.show_solderpaste = m_bodyStyleShowAll;
cfg->m_Render.show_zones = m_bodyStyleShowAll;
cfg->m_Render.show_board_body = m_bodyStyleShowAll;
m_previewPane->ReloadRequest();
m_previewPane->Refresh();
}
void PANEL_PREVIEW_3D_MODEL::View3DSettings( wxCommandEvent& event )
{
BOARD_DESIGN_SETTINGS bds = m_dummyBoard->GetDesignSettings();
int thickness = bds.GetBoardThickness();
WX_UNIT_ENTRY_DIALOG dlg( m_parentFrame, _( "3D Preview Options" ), _( "Board thickness:" ),
thickness );
WX_UNIT_ENTRY_DIALOG dlg( m_parentFrame, _( "Board Thickness: " ),
_( "Preview Settings" ), thickness );
if( dlg.ShowModal() != wxID_OK )
return;
bds.SetBoardThickness( dlg.GetValue() );
bds.SetBoardThickness( (int) dlg.GetValue() );
BOARD_STACKUP& boardStackup = m_dummyBoard->GetDesignSettings().GetStackupDescriptor();
boardStackup.RemoveAll();
@@ -489,8 +471,7 @@ void PANEL_PREVIEW_3D_MODEL::doIncrementOffset( wxSpinEvent& event, double aSign
double step_mm = OFFSET_INCREMENT_MM;
double curr_value_mm =
EDA_UNIT_UTILS::UI::DoubleValueFromString( pcbIUScale, m_userUnits,
textCtrl->GetValue() )
EDA_UNIT_UTILS::UI::DoubleValueFromString( pcbIUScale, m_userUnits, textCtrl->GetValue() )
/ pcbIUScale.IU_PER_MM;
if( m_userUnits == EDA_UNITS::MILS || m_userUnits == EDA_UNITS::INCHES )
+8 -16
View File
@@ -3,7 +3,7 @@
*
* Copyright (C) 2016 Mario Luzeiro <mrluzeiro@ua.pt>
* Copyright (C) 2015 Cirilo Bernardo <cirilo.bernardo@gmail.com>
* Copyright (C) 2015-2023 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2015-2022 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -151,24 +151,19 @@ private:
m_previewPane->Refresh();
}
// turn ON or OFF options to show the board body. If OFF, solder paste, soldermask
// and board body are hidden, to allows a good view of the 3D model and its pads.
// Useful for 3D model placement
void setBodyStyleView( wxCommandEvent& event ) override;
void View3DLeft( wxCommandEvent& event ) override
{
m_previewPane->SetView3D( VIEW3D_TYPE::VIEW3D_LEFT );
m_previewPane->SetView3D( ID_VIEW3D_LEFT );
}
void View3DFront( wxCommandEvent& event ) override
{
m_previewPane->SetView3D( VIEW3D_TYPE::VIEW3D_FRONT );
m_previewPane->SetView3D( ID_VIEW3D_FRONT );
}
void View3DTop( wxCommandEvent& event ) override
{
m_previewPane->SetView3D( VIEW3D_TYPE::VIEW3D_TOP );
m_previewPane->SetView3D( ID_VIEW3D_TOP );
}
void View3DUpdate( wxCommandEvent& event ) override
@@ -181,17 +176,17 @@ private:
void View3DRight( wxCommandEvent& event ) override
{
m_previewPane->SetView3D( VIEW3D_TYPE::VIEW3D_RIGHT );
m_previewPane->SetView3D( ID_VIEW3D_RIGHT );
}
void View3DBack( wxCommandEvent& event ) override
{
m_previewPane->SetView3D( VIEW3D_TYPE::VIEW3D_BACK );
m_previewPane->SetView3D( ID_VIEW3D_BACK );
}
void View3DBottom( wxCommandEvent& event ) override
{
m_previewPane->SetView3D( VIEW3D_TYPE::VIEW3D_BOTTOM );
m_previewPane->SetView3D( ID_VIEW3D_BOTTOM );
}
private:
@@ -206,12 +201,9 @@ private:
FOOTPRINT* m_dummyFootprint;
std::vector<FP_3DMODEL>* m_parentModelList;
int m_selected; /// Index into m_parentInfoList
int m_selected; /// Index into m_parentInfoList
EDA_UNITS m_userUnits;
bool m_bodyStyleShowAll; /// true if the board body is show
/// The 3d viewer Render initial settings (must be saved and restored)
EDA_3D_VIEWER_SETTINGS::RENDER_SETTINGS m_initialRender;
};
#endif // PANEL_PREVIEW_3D_MODEL_H
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-282-g1fa54006)
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@@ -190,18 +190,10 @@ PANEL_PREVIEW_3D_MODEL_BASE::PANEL_PREVIEW_3D_MODEL_BASE( wxWindow* parent, wxWi
wxBoxSizer* bSizer3DButtons;
bSizer3DButtons = new wxBoxSizer( wxVERTICAL );
bSizer3DButtons->Add( 0, 10, 0, 0, 5 );
m_bpvISO = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), wxBU_AUTODRAW|0 );
m_bpvISO->SetToolTip( _("Enable/disable orthographic projection") );
bSizer3DButtons->Add( m_bpvISO, 0, wxTOP, 5 );
m_bpvBodyStyle = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), wxBU_AUTODRAW|0 );
m_bpvBodyStyle->SetToolTip( _("Show or hide the board body\nIf hidden, show only copper and silkscreen layers.") );
bSizer3DButtons->Add( m_bpvBodyStyle, 0, wxTOP|wxBOTTOM, 5 );
bSizer3DButtons->Add( m_bpvISO, 0, wxTOP, 14 );
bSizer3DButtons->Add( 0, 0, 1, wxEXPAND, 5 );
@@ -233,10 +225,7 @@ PANEL_PREVIEW_3D_MODEL_BASE::PANEL_PREVIEW_3D_MODEL_BASE( wxWindow* parent, wxWi
bSizer3DButtons->Add( m_bpUpdate, 0, wxBOTTOM, 5 );
m_bpSettings = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
bSizer3DButtons->Add( m_bpSettings, 0, wxBOTTOM, 5 );
bSizer3DButtons->Add( 0, 10, 0, 0, 5 );
bSizer3DButtons->Add( m_bpSettings, 0, 0, 5 );
bSizermain->Add( bSizer3DButtons, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 );
@@ -285,7 +274,6 @@ PANEL_PREVIEW_3D_MODEL_BASE::PANEL_PREVIEW_3D_MODEL_BASE( wxWindow* parent, wxWi
m_spinZoffset->Connect( wxEVT_SCROLL_LINEUP, wxSpinEventHandler( PANEL_PREVIEW_3D_MODEL_BASE::onIncrementOffset ), NULL, this );
m_opacity->Connect( wxEVT_SLIDER, wxCommandEventHandler( PANEL_PREVIEW_3D_MODEL_BASE::onOpacitySlider ), NULL, this );
m_bpvISO->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREVIEW_3D_MODEL_BASE::View3DISO ), NULL, this );
m_bpvBodyStyle->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREVIEW_3D_MODEL_BASE::setBodyStyleView ), NULL, this );
m_bpvLeft->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREVIEW_3D_MODEL_BASE::View3DLeft ), NULL, this );
m_bpvRight->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREVIEW_3D_MODEL_BASE::View3DRight ), NULL, this );
m_bpvFront->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREVIEW_3D_MODEL_BASE::View3DFront ), NULL, this );
@@ -337,7 +325,6 @@ PANEL_PREVIEW_3D_MODEL_BASE::~PANEL_PREVIEW_3D_MODEL_BASE()
m_spinZoffset->Disconnect( wxEVT_SCROLL_LINEUP, wxSpinEventHandler( PANEL_PREVIEW_3D_MODEL_BASE::onIncrementOffset ), NULL, this );
m_opacity->Disconnect( wxEVT_SLIDER, wxCommandEventHandler( PANEL_PREVIEW_3D_MODEL_BASE::onOpacitySlider ), NULL, this );
m_bpvISO->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREVIEW_3D_MODEL_BASE::View3DISO ), NULL, this );
m_bpvBodyStyle->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREVIEW_3D_MODEL_BASE::setBodyStyleView ), NULL, this );
m_bpvLeft->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREVIEW_3D_MODEL_BASE::View3DLeft ), NULL, this );
m_bpvRight->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREVIEW_3D_MODEL_BASE::View3DRight ), NULL, this );
m_bpvFront->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREVIEW_3D_MODEL_BASE::View3DFront ), NULL, this );
@@ -35,7 +35,6 @@
<property name="bg"></property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="event_handler">impl_virtual</property>
<property name="fg"></property>
@@ -120,7 +119,6 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@@ -182,7 +180,6 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@@ -249,7 +246,6 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@@ -310,7 +306,6 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@@ -372,7 +367,6 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@@ -439,7 +433,6 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@@ -500,7 +493,6 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@@ -562,7 +554,6 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@@ -629,7 +620,6 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@@ -722,7 +712,6 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@@ -784,7 +773,6 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@@ -851,7 +839,6 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@@ -912,7 +899,6 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@@ -974,7 +960,6 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@@ -1041,7 +1026,6 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@@ -1102,7 +1086,6 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@@ -1164,7 +1147,6 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@@ -1231,7 +1213,6 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@@ -1324,7 +1305,6 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@@ -1386,7 +1366,6 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@@ -1453,7 +1432,6 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@@ -1514,7 +1492,6 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@@ -1576,7 +1553,6 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@@ -1643,7 +1619,6 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@@ -1704,7 +1679,6 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@@ -1766,7 +1740,6 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@@ -1833,7 +1806,6 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@@ -1910,7 +1882,6 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@@ -1999,7 +1970,6 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@@ -2061,17 +2031,7 @@
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag"></property>
<property name="proportion">0</property>
<object class="spacer" expanded="1">
<property name="height">10</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="border">14</property>
<property name="flag">wxTOP</property>
<property name="proportion">0</property>
<object class="wxBitmapButton" expanded="1">
@@ -2100,7 +2060,6 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@@ -2145,81 +2104,6 @@
<event name="OnButtonClick">View3DISO</event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxTOP|wxBOTTOM</property>
<property name="proportion">0</property>
<object class="wxBitmapButton" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
<property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">MyButton</property>
<property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_bpvBodyStyle</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size">-1,-1</property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip">Show or hide the board body&#x0A;If hidden, show only copper and silkscreen layers.</property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">setBodyStyleView</event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
@@ -2260,7 +2144,6 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@@ -2335,7 +2218,6 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@@ -2410,7 +2292,6 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@@ -2485,7 +2366,6 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@@ -2560,7 +2440,6 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@@ -2635,7 +2514,6 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@@ -2720,7 +2598,6 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@@ -2767,7 +2644,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxBOTTOM</property>
<property name="flag"></property>
<property name="proportion">0</property>
<object class="wxBitmapButton" expanded="1">
<property name="BottomDockable">1</property>
@@ -2795,7 +2672,6 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@@ -2840,16 +2716,6 @@
<event name="OnButtonClick">View3DSettings</event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag"></property>
<property name="proportion">0</property>
<object class="spacer" expanded="1">
<property name="height">10</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
</object>
</object>
</object>
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-282-g1fa54006)
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@@ -69,7 +69,6 @@ class PANEL_PREVIEW_3D_MODEL_BASE : public wxPanel
wxStaticText* m_previewLabel;
wxBoxSizer* m_SizerPanelView;
wxBitmapButton* m_bpvISO;
wxBitmapButton* m_bpvBodyStyle;
wxBitmapButton* m_bpvLeft;
wxBitmapButton* m_bpvRight;
wxBitmapButton* m_bpvFront;
@@ -92,7 +91,6 @@ class PANEL_PREVIEW_3D_MODEL_BASE : public wxPanel
virtual void onIncrementOffset( wxSpinEvent& event ) { event.Skip(); }
virtual void onOpacitySlider( wxCommandEvent& event ) { event.Skip(); }
virtual void View3DISO( wxCommandEvent& event ) { event.Skip(); }
virtual void setBodyStyleView( wxCommandEvent& event ) { event.Skip(); }
virtual void View3DLeft( wxCommandEvent& event ) { event.Skip(); }
virtual void View3DRight( wxCommandEvent& event ) { event.Skip(); }
virtual void View3DFront( wxCommandEvent& event ) { event.Skip(); }
-1
View File
@@ -50,7 +50,6 @@ Ian McInerney <ian.s.mcinerney[at]ieee-dot-org>
Thomas Pointhuber <thomas.pointhuber[at]gmx-dot-at>
Roberto Fernandez Bautista <roberto.fer.bau[at]gmail-dot-com>
Mikołaj Wielgus <wielgusmikolaj[at]gmail-dot-com>
Mike Williams <mike[at]mikebwilliams-dot-com>
See git repo on GitLab for contributors at
https://gitlab.com/kicad/code/kicad/-/graphs/master
+248 -289
View File
@@ -15,7 +15,6 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, you may find one here:
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
# or you may search the http://www.gnu.org website for the version 2 license,
# or you may write to the Free Software Foundation, Inc.,
@@ -46,7 +45,6 @@ set(CMAKE_CXX_FLAGS_QABUILD "-Os -g1 -ggdb1")
include( GNUInstallDirs )
include( CMakeDependentOption )
include( CheckCXXCompilerFlag )
# Output compile_commands.json for various LSP and other users
set( CMAKE_EXPORT_COMPILE_COMMANDS ON )
@@ -55,8 +53,6 @@ set( CMAKE_EXPORT_COMPILE_COMMANDS ON )
set( KICAD_CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" )
set( CMAKE_MODULE_PATH "${KICAD_CMAKE_MODULE_PATH}" )
include( ConfigurePlatform )
# Create a flag to identify the non-Apple unix systems
if( UNIX AND NOT APPLE )
set( UNIX_NOT_APPLE ON )
@@ -64,11 +60,12 @@ else()
set( UNIX_NOT_APPLE OFF )
endif()
if( APPLE OR WIN32 )
set( APPLE_OR_WIN32 ON )
else()
set( APPLE_OR_WIN32 OFF )
endif()
# On Windows, binaries created by link option -g3 are very large (more than 1Gb for pcbnew,
# and more than 3Gb for the full kicad suite)
# This option create binaries using link option -g1 that create much smaller files, but
# there are less info in debug (but the file names and line numbers are available)
cmake_dependent_option( BUILD_SMALL_DEBUG_FILES "In debug build: create smaller binaries." OFF "NOT MSVC" OFF )
#
# KiCad build options should be added below.
@@ -78,52 +75,29 @@ endif()
# so that build option settings can be included in bug reports.
#
####################################
# Feature flags
####################################
option( KICAD_SPICE_QA
"Build software Quality assurance unit tests for spice (default ON)"
option( KICAD_SCRIPTING_WXPYTHON
"Build wxPython implementation for wx interface building in Python and py.shell (default ON)."
ON )
mark_as_advanced( KICAD_SCRIPTING_WXPYTHON )
option( KICAD_INSTALL_DEMOS
"Install KiCad demos and examples (default ON)"
ON )
option( KICAD_USE_SENTRY
"Build KiCad with support for sentry app metrics"
OFF )
option( KICAD_BUILD_QA_TESTS
"Build software Quality assurance unit tests (default ON)"
ON )
option( KICAD_SIGNAL_INTEGRITY
"Build tools for signal integrity analysis ( default ON )"
option( KICAD_SPICE
"Build KiCad with internal Spice simulator."
ON )
option( KICAD_BUILD_I18N
"Build the translation libraries."
OFF )
option( KICAD_BUILD_QA_TESTS
"Build software Quality assurance unit tests (default ON)"
ON )
option( KICAD_SCRIPTING_WXPYTHON
"Build wxPython implementation for wx interface building in Python and py.shell (default ON)."
ON )
mark_as_advanced( KICAD_SCRIPTING_WXPYTHON )
option( KICAD_UPDATE_CHECK
"Build in update check"
ON )
# EGL is only needed on Linux with Wayland
cmake_dependent_option( KICAD_USE_EGL
"Build KiCad with EGL backend support for Wayland."
OFF "UNIX_NOT_APPLE"
OFF)
cmake_dependent_option( KICAD_USE_BUNDLED_GLEW
"Use the bundled version of GLEW - only available when KICAD_USE_EGL is set"
ON "KICAD_USE_EGL"
OFF )
cmake_dependent_option( KICAD_WAYLAND
"Support Wayland features"
ON "KICAD_USE_EGL"
option( KICAD_I18N_UNIX_STRICT_PATH
"Use standard Unix locale lookup path (default OFF)."
OFF )
# Options to build with flatpak platform defaults (only on Linux)
@@ -137,64 +111,19 @@ cmake_dependent_option( KICAD_BUILD_NIGHTLY_FLATPAK
OFF "UNIX_NOT_APPLE"
OFF )
cmake_dependent_option( KICAD_WIN32_DPI_AWARE
"Turn on DPI awareness for Windows builds only"
OFF "WIN32"
OFF )
cmake_dependent_option( KICAD_WIN32_VERIFY_CODESIGN
"When enabled, verifies the code signing signature of certain DLLs loaded during runtime."
OFF "WIN32"
OFF )
# On Windows, binaries created by link option -g3 are very large (more than 1Gb for pcbnew,
# and more than 3Gb for the full kicad suite)
# This option create binaries using link option -g1 that create much smaller files, but
# there are less info in debug (but the file names and line numbers are available)
cmake_dependent_option( KICAD_BUILD_SMALL_DEBUG_FILES
"Create smaller binaries in debug builds."
OFF "NOT MSVC"
OFF )
cmake_dependent_option( KICAD_APPLE_MAKE_RELOCATEABLE_BUNDLE
"On macOS, post-process the build to make it relocateable (default ON)"
ON "APPLE" OFF )
####################################
# Installation options
####################################
option( KICAD_INSTALL_DEMOS
"Install KiCad demos and examples (default ON)"
ON )
option( KICAD_I18N_UNIX_STRICT_PATH
"Use standard Unix locale lookup path (default OFF)."
OFF )
cmake_dependent_option( KICAD_WIN32_INSTALL_PDBS
"Installs debug pdb to the bin folder, DO NOT USE (NOR REQUIRED) FOR DEBUGGING THE SOURCE ON MSVC. This is purely for release building.
MSVC can find the PDBs without this."
OFF "WIN32"
OFF )
####################################
# Compiler options/tools
####################################
# Not supported by all platforms (for instance mingw)
option( KICAD_SANITIZE_ADDRESS
"Build KiCad with address sanitizer options. WARNING: Not compatible with gold linker"
"Build KiCad with sanitizer options. WARNING: Not compatible with gold linker"
OFF )
# Not supported by all platforms (for instance mingw)
option( KICAD_SANITIZE_THREADS
"Build KiCad with thread sanitizer options. WARNING: Not compatible with gold linker"
"Build KiCad with sanitizer options. WARNING: Not compatible with gold linker"
OFF )
# Enable additional valgrind instrumentation for stack tracking in libcontext
option( KICAD_USE_VALGRIND
"Build KiCad with valgrind stack tracking enabled."
OFF )
option( KICAD_SIGNAL_INTEGRITY
"Build tools for signal integrity analysis ( default ON )"
ON )
option( KICAD_STDLIB_DEBUG
"Build KiCad with libstdc++ debug flags enabled."
@@ -206,31 +135,33 @@ option( KICAD_STDLIB_LIGHT_DEBUG
cmake_dependent_option( KICAD_WIN32_BUILD_PARALLEL_CL_MP
"Build in parallel using the /MP compiler option (default OFF for safety reasons)"
OFF "WIN32"
OFF "WIN32" OFF )
option( KICAD_USE_VALGRIND
"Build KiCad with valgrind stack tracking enabled."
OFF )
cmake_dependent_option( KICAD_WIN32_LTCG
"Enable Whole Program Optimization"
OFF "WIN32"
option( KICAD_NETLIST_QA
"Run eeschema netlist QA tests (requires Python 3)"
OFF )
# Advanced option to make link maps (only available on linux)
cmake_dependent_option( KICAD_MAKE_LINK_MAPS
"Create link maps for artifacts"
OFF "UNIX_NOT_APPLE"
cmake_dependent_option( KICAD_WIN32_DPI_AWARE
"Turn on DPI awareness for Windows builds only"
OFF "WIN32" OFF )
cmake_dependent_option( KICAD_WIN32_CONTEXT_WINFIBER
"Use win32 fibers for libcontext"
OFF "WIN32" OFF )
option( KICAD_USE_EGL
"Build KiCad with EGL backend support for Wayland."
OFF )
mark_as_advanced( KICAD_MAKE_LINK_MAPS )
set( KICAD_INIT_VARIABLES "Default" CACHE STRING "Specify how compiler should initialize variables" )
set_property( CACHE KICAD_INIT_VARIABLES PROPERTY STRINGS
"Default" # Equivalent to pattern in debug mode (but not when Valgrind is used), zero in release mode
"Off" # Don't initialize anything
"Zero" # Initialize trivial variables to 0
"Pattern" ) # Initialize trivial variables to a non-zero pattern to flag them (usually 0xAA...)
cmake_dependent_option( KICAD_USE_BUNDLED_GLEW
"Use the bundled version of GLEW - only available when KICAD_USE_EGL is set"
ON "KICAD_USE_EGL"
OFF )
####################################
# Debugging/profiling
####################################
option( KICAD_DRC_PROTO
"Build the DRC prototype QA tool"
OFF )
@@ -247,6 +178,35 @@ option( KICAD_GAL_PROFILE
"Enable profiling info for GAL"
OFF )
cmake_dependent_option( KICAD_WIN32_INSTALL_PDBS
"Installs debug pdb to the bin folder, DO NOT USE (NOR REQUIRED) FOR DEBUGGING THE SOURCE ON MSVC. This is purely for release building.
MSVC can find the PDBs without this."
OFF "WIN32"
OFF )
option( KICAD_USE_3DCONNEXION
"Build KiCad with support for 3Dconnexion devices (Currently only for Mac/MSW)"
OFF )
cmake_dependent_option( KICAD_WIN32_VERIFY_CODESIGN
"When enabled, verifies the code signing signature of certain DLLs loaded during runtime."
OFF "WIN32"
OFF )
option( KICAD_USE_SENTRY
"Build KiCad with support for sentry app metrics"
OFF )
if( KICAD_USE_3DCONNEXION )
if( WIN32 )
add_definitions( -DKICAD_USE_3DCONNEXION )
elseif( APPLE )
add_definitions( -DKICAD_USE_3DCONNEXION )
else()
remove_definitions( -DKICAD_USE_3DCONNEXION )
endif()
endif()
# Global setting: exports are explicit
set( CMAKE_CXX_VISIBILITY_PRESET "hidden" )
set( CMAKE_VISIBILITY_INLINES_HIDDEN ON )
@@ -259,34 +219,30 @@ set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Pass defines into KiCad code based on the build options set
add_compile_definitions( $<$<BOOL:${KICAD_SCRIPTING_WXPYTHON}>:KICAD_SCRIPTING_WXPYTHON> )
add_compile_definitions( $<$<BOOL:${KICAD_SIGNAL_INTEGRITY}>:KICAD_SIGNAL_INTEGRITY> )
add_compile_definitions( $<$<BOOL:${KICAD_USE_VALGRIND}>:KICAD_USE_VALGRIND> )
add_compile_definitions( $<$<BOOL:${KICAD_GAL_PROFILE}>:KICAD_GAL_PROFILE> )
add_compile_definitions( $<$<BOOL:${KICAD_WIN32_VERIFY_CODESIGN}>:KICAD_WIN32_VERIFY_CODESIGN> )
add_compile_definitions( $<$<BOOL:${KICAD_UPDATE_CHECK}>:KICAD_UPDATE_CHECK> )
if( KICAD_USE_EGL )
message( STATUS "Configuring KiCad for the wxGLCanvas EGL backend" )
add_compile_definitions( KICAD_USE_EGL )
# Enable additional valgrind instrumentation for stack tracking in libcontext
if( KICAD_USE_VALGRIND )
add_definitions( -DKICAD_USE_VALGRIND )
endif()
if( KICAD_WAYLAND )
message( STATUS "Configuring KiCad to support Wayland features" )
add_compile_definitions( KICAD_WAYLAND )
if( KICAD_GAL_PROFILE )
add_definitions( -DKICAD_GAL_PROFILE )
endif()
if( KICAD_WIN32_VERIFY_CODESIGN )
add_definitions( -DKICAD_WIN32_VERIFY_CODESIGN )
endif()
# Ensure DEBUG is defined for all platforms in Debug builds
add_compile_definitions( $<$<CONFIG:Debug>:DEBUG> )
# change to add_compile_definitions() after minimum required CMake version is 3.12
set_property( DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS $<$<CONFIG:Debug>:DEBUG> )
# Add option to add user directories for linker, if any
link_directories( ${LINK_DIRECTORIES_PATH} )
LINK_DIRECTORIES( ${LINK_DIRECTORIES_PATH} )
set( KICAD_CONFIG_DIR "kicad" CACHE STRING "Location of user specific KiCad config files" )
mark_as_advanced( KICAD_CONFIG_DIR )
add_compile_definitions( KICAD_CONFIG_DIR=${KICAD_CONFIG_DIR} )
add_definitions( -DKICAD_CONFIG_DIR=${KICAD_CONFIG_DIR} )
# Set default data file path to CMAKE_INSTALL_PREFIX if it wasn't specified during the
# CMake configuration. The value of DEFAULT_INSTALL_PATH is expanded in config.h and
@@ -305,25 +261,71 @@ message( STATUS "KiCad install dir: <${DEFAULT_INSTALL_PATH}>" )
include( PerformFeatureChecks )
perform_feature_checks()
# Setup the compiler warnings
include( ${KICAD_CMAKE_MODULE_PATH}/Warnings.cmake )
if( KICAD_WIN32_CONTEXT_WINFIBER )
set(LIBCONTEXT_USE_WINFIBER true)
add_compile_definitions(LIBCONTEXT_USE_WINFIBER)
else()
set(LIBCONTEXT_USE_WINFIBER false)
endif()
if( WIN32 )
# define UNICODE and_UNICODE definition on Windows. KiCad uses unicode.
# Both definitions are required
add_compile_definitions( UNICODE _UNICODE)
add_definitions(-DUNICODE -D_UNICODE)
# In fully standards-compliant mode, M_PI et al. are defined only if
# _USE_MATH_DEFINES is set.
add_compile_definitions( _USE_MATH_DEFINES )
add_definitions( -D_USE_MATH_DEFINES )
add_compile_definitions( $<$<BOOL:${KICAD_WIN32_DPI_AWARE}>:KICAD_WIN32_DPI_AWARE=1> )
# Used for the resource compiler and other arch dependent steps
if( MSVC )
# CMake does not set CMAKE_SYSTEM_PROCESSOR correctly for MSVC
# and it will always return the host instead of the target arch
if("${MSVC_C_ARCHITECTURE_ID}" STREQUAL "ARM64")
set( KICAD_BUILD_ARCH "arm64" )
set( KICAD_BUILD_ARCH_ARM64 1 )
elseif("${MSVC_C_ARCHITECTURE_ID}" STREQUAL "ARM")
set( KICAD_BUILD_ARCH "arm" )
set( KICAD_BUILD_ARCH_ARM 1 )
elseif("${MSVC_C_ARCHITECTURE_ID}" STREQUAL "X86")
set( KICAD_BUILD_ARCH "x86" )
set( KICAD_BUILD_ARCH_X86 1 )
elseif("${MSVC_C_ARCHITECTURE_ID}" STREQUAL "x64")
set( KICAD_BUILD_ARCH "x64" )
set( KICAD_BUILD_ARCH_X64 1 )
else()
message(FATAL_ERROR "Failed to determine the MSVC target architecture: ${MSVC_C_ARCHITECTURE_ID}")
endif()
else()
if ( NOT CMAKE_SIZEOF_VOID_P EQUAL 8 )
set( KICAD_BUILD_ARCH "x86" )
set( KICAD_BUILD_ARCH_X86 1 )
elseif( CMAKE_SIZEOF_VOID_P EQUAL 8 )
set( KICAD_BUILD_ARCH "x64" )
set( KICAD_BUILD_ARCH_X64 1 )
endif()
endif()
add_definitions( -DKICAD_BUILD_ARCH=${KICAD_BUILD_ARCH} )
if( KICAD_WIN32_DPI_AWARE )
add_definitions( -DKICAD_WIN32_DPI_AWARE=1 )
endif()
endif()
add_compile_definitions( $<$<BOOL:${KICAD_BUILD_ARCH_X86}>:KICAD_BUILD_ARCH_X86> )
add_compile_definitions( $<$<BOOL:${KICAD_BUILD_ARCH_X64}>:KICAD_BUILD_ARCH_X64> )
add_compile_definitions( $<$<BOOL:${KICAD_BUILD_ARCH_ARM}>:KICAD_BUILD_ARCH_ARM> )
add_compile_definitions( $<$<BOOL:${KICAD_BUILD_ARCH_ARM64}>:KICAD_BUILD_ARCH_ARM64> )
if(KICAD_BUILD_ARCH_X64)
add_definitions( -DKICAD_BUILD_ARCH_X64 )
elseif(KICAD_BUILD_ARCH_X86)
add_definitions( -DKICAD_BUILD_ARCH_X86 )
elseif(KICAD_BUILD_ARCH_ARM64)
add_definitions( -DKICAD_BUILD_ARCH_ARM64 )
elseif(KICAD_BUILD_ARCH_ARM)
add_definitions( -DKICAD_BUILD_ARCH_ARM )
endif()
#================================================
# Provide access to CCACHE
@@ -363,28 +365,26 @@ endif(USE_DISTCC)
#================================================
# Setup compiler-specific flags
# Set flags for GCC, or treat llvm as GCC
#================================================
if( CMAKE_COMPILER_IS_GNUCXX )
# Set 32-bit flag for GCC to prevent excess precision (not needed for Clang)
# Set 32-bit flag for GCC to prevent excess precision
# clang des not know this flag, so keep this separate
if( CMAKE_SIZEOF_VOID_P EQUAL 4 )
set( CMAKE_CXX_FLAGS "-ffloat-store ${CMAKE_CXX_FLAGS}" )
endif()
endif( CMAKE_COMPILER_IS_GNUCXX )
if( CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
# Clang needs this flag or wxStrings, etc. won't be viewable in the debugger
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstandalone-debug" )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstandalone-debug" )
endif()
if( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
# Link flags in Debug: -g1 and -ggdb1 or -g1 and -ggdb3 can be used.
# Level 1 produces minimal information, enough for making basic backtraces.
# This includes descriptions of functions and external variables, and line number tables,
# but no information about local variables.
# Level 3 includes full information, but binaries are much larger.
if( KICAD_BUILD_SMALL_DEBUG_FILES )
if( BUILD_SMALL_DEBUG_FILES )
set( CMAKE_C_FLAGS_DEBUG "-g1 -ggdb1" )
set( CMAKE_CXX_FLAGS_DEBUG "-g1 -ggdb1" )
else()
@@ -392,48 +392,14 @@ if( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
set( CMAKE_CXX_FLAGS_DEBUG "-g3 -ggdb3" )
endif()
check_cxx_compiler_flag( "-ftrivial-auto-var-init=pattern" COMPILER_SUPPORTS_TRIVIAL_PATTERN_INIT )
if( COMPILER_SUPPORTS_TRIVIAL_PATTERN_INIT )
set( VAR_PATTERN_INIT_FLAGS -ftrivial-auto-var-init=pattern )
endif()
check_cxx_compiler_flag( "-ftrivial-auto-var-init=zero" COMPILER_SUPPORTS_TRIVIAL_ZERO_INIT )
if( COMPILER_SUPPORTS_TRIVIAL_ZERO_INIT )
set( VAR_ZERO_INIT_FLAGS -ftrivial-auto-var-init=zero )
else()
# Clang 15 and below required a special flag to enable the zero-init flag, so try that
check_cxx_compiler_flag( "-ftrivial-auto-var-init=zero -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang"
COMPILER_REQUIRES_ENABLE_TRIVIAL_ZERO_INIT )
if( COMPILER_REQUIRES_ENABLE_TRIVIAL_ZERO_INIT )
set( VAR_ZERO_INIT_FLAGS -ftrivial-auto-var-init=zero -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang )
endif()
endif()
if( NOT KICAD_INIT_VARIABLES STREQUAL "Off" )
if( KICAD_INIT_VARIABLES STREQUAL "Default" )
# Disable when using valgrind to preserve reporting of uninitialized variables
if( NOT KICAD_USE_VALGRIND )
# Use pattern init in debug mode only, use zero init every other time
if( CMAKE_BUILD_TYPE STREQUAL "Debug" )
set( VAR_INIT_FLAGS ${VAR_PATTERN_INIT_FLAGS} )
else()
set( VAR_INIT_FLAGS ${VAR_ZERO_INIT_FLAGS} )
endif()
endif()
elseif( KICAD_INIT_VARIABLES STREQUAL "Zero" )
set( VAR_INIT_FLAGS ${VAR_ZERO_INIT_FLAGS} )
elseif( KICAD_INIT_VARIABLES STREQUAL "Pattern" )
set( VAR_INIT_FLAGS ${VAR_PATTERN_INIT_FLAGS} )
endif()
if( VAR_INIT_FLAGS )
add_compile_options( ${VAR_INIT_FLAGS} )
message( STATUS "Initializing trivial variables (${VAR_INIT_FLAGS})" )
endif()
# Clang needs this flag or wxStrings, etc. won't be viewable in the debugger
if( CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstandalone-debug" )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstandalone-debug" )
endif()
if( KICAD_SANITIZE_ADDRESS )
add_compile_definitions( KICAD_SANITIZE_ADDRESS )
add_definitions( -DKICAD_SANITIZE_ADDRESS )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GLIBCXX_SANITIZE_VECTOR -fsanitize=address -fno-optimize-sibling-calls -fsanitize-address-use-after-scope -fno-omit-frame-pointer" )
# ASAN shouldn't be used with these options (https://github.com/google/sanitizers/wiki/AddressSanitizer#faq)
@@ -441,7 +407,7 @@ if( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
endif()
if( KICAD_SANITIZE_THREADS )
add_compile_definitions( KICAD_SANITIZE_THREADS )
add_definitions( -DKICAD_SANITIZE_THREADS )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GLIBCXX_SANITIZE_VECTOR -fsanitize=thread -fno-optimize-sibling-calls -fno-omit-frame-pointer" )
# Based on this warning https://github.com/JuliaLang/julia/blob/29d5158d27ddc3983ae2e373c4cd05569b9ead6c/src/julia.h#L77
@@ -455,12 +421,12 @@ if( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
endif()
if( KICAD_STDLIB_DEBUG )
add_compile_definitions( KICAD_STDLIB_DEBUG )
add_definitions( -DKICAD_STDLIB_DEBUG )
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_GLIBCXX_DEBUG" )
elseif( KICAD_STDLIB_LIGHT_DEBUG )
# useless if KICAD_STDLIB_DEBUG is ON.
# this option makes some controls to trap out of bound memory access.
add_compile_definitions( KICAD_STDLIB_LIGHT_DEBUG )
add_definitions( -DKICAD_STDLIB_LIGHT_DEBUG )
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wp,-D_GLIBCXX_ASSERTIONS" )
endif()
@@ -478,12 +444,12 @@ if( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
# for some reasons, cmake does do use always a response file to send the list of objects
# to the archiver, and because this list can be very long, and can create issue
# when it is used in a command line, force use of a response file to store it
set( CMAKE_CXX_USE_RESPONSE_FILE_FOR_OBJECTS 1 )
SET( CMAKE_CXX_USE_RESPONSE_FILE_FOR_OBJECTS 1 )
# The MinGW compiler can use the microsoft system snprintf as standard and it has a broken
# API with respect to the C99 standard, so make sure we force it to use its own compliant
# snprintf
add_compile_definitions( __USE_MINGW_ANSI_STDIO=1 )
add_definitions(-D__USE_MINGW_ANSI_STDIO=1)
# Allow linking for Boost for the UUID against bcrypt
set( EXTRA_LIBS "bcrypt" )
@@ -499,13 +465,13 @@ if( MSVC )
include_directories( ${CMAKE_SOURCE_DIR}/resources/msw/ )
# Disallow implicit linking for Boost
add_compile_definitions( BOOST_ALL_NO_LIB )
add_definitions( -DBOOST_ALL_NO_LIB )
# But allow it for the UUID so that it will link against bcrypt
add_compile_definitions( BOOST_UUID_FORCE_AUTO_LINK )
add_definitions( -DBOOST_UUID_FORCE_AUTO_LINK )
# Disable MSVC's deprecation warnings
add_compile_definitions( _CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_DEPRECATE _SCL_SECURE_NO_WARNINGS )
add_definitions( -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS )
# Hide Windows's min() and max() macros
add_compile_definitions( NOMINMAX )
add_definitions( -DNOMINMAX )
# source and execution charset are UTF-8
string( APPEND CMAKE_CXX_FLAGS " /utf-8" )
# C4290: throw() is interpreted as declspec(nothrow)
@@ -514,8 +480,6 @@ if( MSVC )
string( APPEND CMAKE_CXX_FLAGS " /wd4800" )
# /Zi: create PDB
string( APPEND CMAKE_CXX_FLAGS " /Zi" )
# /Zc:__cplusplus: define this macro according to C++ standard version
string( APPEND CMAKE_CXX_FLAGS " /Zc:__cplusplus" )
# /GF: enable string pooling
string( APPEND CMAKE_CXX_FLAGS_RELEASE " /GF" )
string( APPEND CMAKE_CXX_FLAGS_RELWITHDEBINFO " /GF" )
@@ -524,20 +488,17 @@ if( MSVC )
string( APPEND CMAKE_CXX_FLAGS_RELWITHDEBINFO " /Gy" )
# Avoid fatal error because /GF + swig wrapper exceed standard obj file limits
string( APPEND CMAKE_CXX_FLAGS " /bigobj" )
# /permissive-: This puts MSVC into compliance mode, this flag is default on with C++20
# but we want to turn it on to enable debug performance improvements available under C++17 in MSVC 17.5+
string( APPEND CMAKE_CXX_FLAGS " /permissive-" )
# Exception handling
# Remove the potential default EHsc option cmake doesn't allow us to remove easily
string( REPLACE "/EHsc" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} )
if( KICAD_WIN32_CONTEXT_WINFIBER )
# /EHsc: ensure standard exception C++ unwinding is enabled, "extern C" can never throw exceptions
string( APPEND CMAKE_CXX_FLAGS " /EHsc" )
# /EHsc: ensure standard exception C++ unwinding is enabled, "extern C" can never throw exceptions
string( APPEND CMAKE_CXX_FLAGS " /EHsc" )
else()
# the asm libcontext implementation a slight change of rules
# /EHs: ensure standard exception C++ unwinding is enabled, "extern C" MAY throw exceptions
string( APPEND CMAKE_CXX_FLAGS " /EHs" )
# the asm libcontext implementation a slight change of rules
# /EHs: ensure standard exception C++ unwinding is enabled, "extern C" MAY throw exceptions
string( APPEND CMAKE_CXX_FLAGS " /EHs" )
endif()
if( KICAD_SANITIZE_ADDRESS )
@@ -546,12 +507,6 @@ if( MSVC )
string( APPEND CMAKE_CXX_FLAGS " /fsanitize=address" )
endif()
if( KICAD_WIN32_LTCG )
# we are implementing this manually because CMake's LTCG option is incomplete
# https://gitlab.kitware.com/cmake/cmake/-/issues/20484
string( APPEND CMAKE_CXX_FLAGS_RELEASE " /GL" )
endif()
foreach( type EXE SHARED MODULE)
# /DEBUG: create PDB
string( APPEND CMAKE_${type}_LINKER_FLAGS " /DEBUG /MANIFEST:NO" )
@@ -561,12 +516,6 @@ if( MSVC )
# /OPT:ICF: fold common data
string( APPEND CMAKE_${type}_LINKER_FLAGS_RELEASE " /OPT:ICF /MANIFEST:NO" )
string( APPEND CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO " /OPT:ICF /MANIFEST:NO" )
if( KICAD_WIN32_LTCG )
# we are implementing this manually because CMake's LTCG option is incomplete
# https://gitlab.kitware.com/cmake/cmake/-/issues/20484
string( APPEND CMAKE_${type}_LINKER_FLAGS_RELEASE " /LTCG" )
endif()
endforeach()
# Let cl.exe parallelize builds
@@ -575,6 +524,26 @@ if( MSVC )
endif()
endif()
if( KICAD_SCRIPTING_WXPYTHON )
add_definitions( -DKICAD_SCRIPTING_WXPYTHON )
endif()
if( KICAD_SPICE )
add_definitions( -DKICAD_SPICE )
endif()
if( KICAD_SIGNAL_INTEGRITY )
add_definitions( -DKICAD_SIGNAL_INTEGRITY )
endif()
if( KICAD_USE_EGL AND UNIX AND NOT APPLE )
message( STATUS "Configuring KiCad for the wxGLCanvas EGL backend" )
add_definitions( -DKICAD_USE_EGL )
elseif( KICAD_USE_EGL )
message( STATUS "Ignoring KICAD_USE_EGL since not on Linux" )
endif()
# KIFACE_SUFFIX is the file extension used for top level program modules which
# implement the KIFACE interface. A valid suffix starts with a period '.'.
@@ -693,13 +662,31 @@ else()
set( KICAD_DEMOS demos
CACHE PATH "Location of KiCad demo files." FORCE )
# Required to run from build folder
if( PYTHON_FRAMEWORK )
list(APPEND CMAKE_BUILD_RPATH ${PYTHON_FRAMEWORK} )
endif()
# RPATH settings for building shared libraries
set( CMAKE_MACOSX_RPATH FALSE )
# Override default paths for fixup_bundle
set( OSX_BUNDLE_OVERRIDE_PATHS "
function( gp_item_default_embedded_path_override item default_embedded_path_var )
# by default, embed things right next to the main bundle executable:
set( path \"@executable_path/../../Contents/MacOS\" )
set( overridden 0 )
# embed .dylibs right next to the main bundle executable:
if( item MATCHES \"\\\\.dylib$\" )
set( path \"@executable_path/../Frameworks\" )
set( overridden 1 )
endif()
set( \${default_embedded_path_var} \"\${path}\" PARENT_SCOPE )
endfunction(gp_item_default_embedded_path_override)
# If `BU_CHMOD_BUNDLE_ITEMS` is not set, `install_name_tool` will fail to re-write some
# loader paths due to lack of writable permissions if the build dependencies were installed
# by brew (or didn't have writable permissions)
set ( BU_CHMOD_BUNDLE_ITEMS ON )
"
)
endif()
mark_as_advanced( KICAD_BIN
@@ -729,12 +716,8 @@ endif()
#
# Find OpenGL library, required
#
if( KICAD_USE_EGL )
find_package( OpenGL REQUIRED COMPONENTS OpenGL EGL )
else()
set( OpenGL_GL_PREFERENCE "LEGACY" ) # CMake 3.11+ setting; see 'cmake --help-policy CMP0072'
find_package( OpenGL REQUIRED )
endif()
set( OpenGL_GL_PREFERENCE "LEGACY" ) # CMake 3.11+ setting; see 'cmake --help-policy CMP0072'
find_package( OpenGL REQUIRED )
#
# Find GLEW library, required
@@ -767,18 +750,21 @@ endif()
# Find GLM library, required
#
find_package( GLM 0.9.8 REQUIRED )
add_compile_definitions( GLM_FORCE_CTOR_INIT )
add_definitions( -DGLM_FORCE_CTOR_INIT )
include_directories( SYSTEM ${GLM_INCLUDE_DIR} )
#
# Find zlib library, required
#
find_package(ZLIB REQUIRED)
check_find_package_result( ZLIB_FOUND "ZLIB" )
include_directories( SYSTEM ${ZLIB_INCLUDE_DIRS} )
#
# Find libcurl, required
# Find CURL library, required
#
find_package( CURL REQUIRED )
include_directories( SYSTEM ${CURL_INCLUDE_DIRS} )
#
# Find Cairo library, required
@@ -789,22 +775,10 @@ include_directories( SYSTEM ${CAIRO_INCLUDE_DIR} )
find_package( Pixman 0.30 REQUIRED )
include_directories( SYSTEM ${PIXMAN_INCLUDE_DIR} )
# Find libgit2, required
find_package( libgit2 REQUIRED )
# Set include directories for libgit
include_directories(${LIBGIT2_INCLUDE_DIRS})
#
# Find Boost headers and libraries, required.
set( BOOST_REQUESTED_COMPONENTS locale ) # locale is required by nanoodbc/database libraries
if( KICAD_BUILD_QA_TESTS )
# required by the unit test framework
list( APPEND BOOST_REQUESTED_COMPONENTS unit_test_framework )
endif()
find_package( Boost 1.71.0 REQUIRED COMPONENTS ${BOOST_REQUESTED_COMPONENTS} )
# Find Boost headers, required.
find_package( Boost 1.71.0 REQUIRED )
include_directories( SYSTEM ${Boost_INCLUDE_DIR} )
#
# Libraries required for outline font support.
@@ -825,7 +799,9 @@ find_package( Fontconfig REQUIRED )
include( MinGWResourceCompiler )
# Find ngspice library, required for integrated circuit simulator
find_package( ngspice REQUIRED )
if( KICAD_SPICE )
find_package( ngspice REQUIRED )
endif()
# Find OpenCascade, required for STEP plugin and tools
find_package(OCC)
@@ -834,10 +810,10 @@ if( NOT OCC_FOUND )
" OpenCASCADE was not found!\n"
"================================================================\n")
endif()
if( OCC_VERSION_STRING VERSION_LESS 7.5.0 )
if( OCC_VERSION_STRING VERSION_LESS 7.3.0 )
MESSAGE( FATAL_ERROR "================================================================\n"
"OpenCASCADE version ${OCC_VERSION_STRING} was found.\n"
" KiCad requires a minimum version of 7.5.0\n"
" KiCad requires a minimum version of 7.3.0\n"
"================================================================\n")
endif()
include_directories( SYSTEM ${OCC_INCLUDE_DIR} )
@@ -878,14 +854,7 @@ check_find_package_result( PYTHONINTERP_FOUND "Python Interpreter" )
# Get the correct Python site package install path from the Python interpreter found by
# FindPythonInterp unless the user specifically defined a custom path.
if( NOT PYTHON_SITE_PACKAGE_PATH )
execute_process( COMMAND ${PYTHON_EXECUTABLE} -c "import sys, sysconfig
if 'deb_system' in sysconfig.get_scheme_names():
scheme = 'deb_system'
elif sys.version_info > (3, 10):
scheme = sysconfig.get_default_scheme()
else:
scheme = sysconfig._get_default_scheme()
print(\"%s\"%sysconfig.get_path('platlib', vars={'platbase': '.'}, scheme=scheme))"
execute_process( COMMAND ${PYTHON_EXECUTABLE} -c "import distutils.sysconfig;print(\"%s\"%distutils.sysconfig.get_python_lib(plat_specific=0, standard_lib=0, prefix=''))"
OUTPUT_VARIABLE PYTHON_SITE_PACKAGE_PATH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
@@ -901,8 +870,8 @@ if( APPLE )
set( PYTHON_DEST "${OSX_BUNDLE_BUILD_DIR}/${OSX_BUNDLE_PYTHON_SITE_PACKAGES_DIR}"
CACHE PATH "Python module install path."
)
add_compile_definitions( OSX_BUNDLE_PYTHON_SITE_PACKAGES_DIR="${OSX_BUNDLE_PYTHON_SITE_PACKAGES_DIR}" )
# change to add_compile_definitions() after minimum required CMake version is 3.12
set_property( DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS OSX_BUNDLE_PYTHON_SITE_PACKAGES_DIR="${OSX_BUNDLE_PYTHON_SITE_PACKAGES_DIR}")
elseif( VCPKG_TOOLCHAIN )
set( PYTHON_DEST "${CMAKE_INSTALL_PREFIX}/bin/Lib/site-packages"
CACHE PATH "Python module install path."
@@ -940,18 +909,11 @@ set( INC_AFTER ${INC_AFTER} ${PYTHON_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}/s
if( KICAD_SCRIPTING_WXPYTHON )
# Find the wxPython installation
if( NOT VCPKG_TOOLCHAIN AND NOT KICAD_BUILD_ARCH_ARM64 )
find_package( wxPython REQUIRED )
find_package( wxPython REQUIRED )
if( WXPYTHON_VERSION VERSION_LESS 4.0.0 )
message( FATAL_ERROR "wxPython Phoenix is required" )
endif()
if( WXPYTHON_WXVERSION VERSION_LESS 3.2.0 )
message( FATAL_ERROR "wxWidgets 3.2.0 or greater is required" )
endif()
if( WXPYTHON_VERSION VERSION_LESS 4.0.0 )
message( FATAL_ERROR "wxPython Phoenix is required" )
endif()
endif()
# GTK3 is required on Linux
@@ -971,6 +933,10 @@ endif()
# Find wxWidgets library, required
#
# Turn on wxWidgets compatibility mode for some classes
add_definitions( -DWX_COMPATIBILITY )
# Check if '--toolkit=xxx' option has been passed
string( REGEX MATCH "--toolkit=([a-zA-Z0-9]+)"
WXWIDGETS_REQUESTED_TOOLKIT "${wxWidgets_CONFIG_OPTIONS}" )
@@ -989,11 +955,7 @@ else()
endif()
# Require the same wxWidgets version as is used by wxPython
if( KICAD_SCRIPTING_WXPYTHON )
set( wxWidgets_REQ_VERSION ${WXPYTHON_WXVERSION} )
else()
set( wxWidgets_REQ_VERSION 3.2.0 )
endif()
set( wxWidgets_REQ_VERSION ${WXPYTHON_WXVERSION} )
# See line 49 of cmake/FindwxWidgets.cmake
set( wxWidgets_CONFIG_OPTIONS ${wxWidgets_CONFIG_OPTIONS} --static=no )
@@ -1003,12 +965,6 @@ find_package( wxWidgets ${wxWidgets_REQ_VERSION} COMPONENTS gl aui adv html core
# Include wxWidgets macros.
include( ${wxWidgets_USE_FILE} )
if( NOT MSVC )
if( ${wxWidgets_VERSION_STRING} VERSION_LESS 3.2 )
message( FATAL_ERROR "wxWidgets 3.2.0 or greater is required" )
endif()
endif()
if( MINGW )
# This needs to be on a separate line to protect against a broken FindWxWidgets.cmake in vcpkg
if( ${wxWidgets_VERSION_STRING} VERSION_LESS 3.1 )
@@ -1039,16 +995,9 @@ endif()
if( KICAD_USE_SENTRY )
set( KICAD_SENTRY_DSN "" CACHE STRING "The sentry DSN used with sentry integration" )
if ( KICAD_SENTRY_DSN STREQUAL "")
message( FATAL_ERROR "Sentry DSN must be configured with KICAD_USE_SENTRY" )
endif()
if( WIN32 )
set( CRASHPAD_WER_ENABLED ON )
endif()
set( CRASHPAD_WER_ENABLED ON )
add_subdirectory( thirdparty/sentry-native )
add_compile_definitions( KICAD_USE_SENTRY )
add_definitions( -DKICAD_USE_SENTRY )
endif()
#================================================
@@ -1062,6 +1011,17 @@ add_subdirectory( doxygen )
configure_file( ${PROJECT_SOURCE_DIR}/cmake/config.h.cmake
${CMAKE_BINARY_DIR}/config.h )
###
# Generate Map file
###
if( KICAD_MAKE_LINK_MAPS )
# Currently only works on linux/gcc
if( UNIX AND NOT APPLE )
set( MAKE_LINK_MAPS true )
else()
set( MAKE_LINK_MAPS false )
endif()
endif()
#================================================
# "make uninstall" rules
@@ -1081,7 +1041,6 @@ add_custom_target( uninstall
include( CTest )
enable_testing()
list( APPEND CMAKE_CTEST_ARGUMENTS "--output-on-failure" )
#================================================
# Let CMake look in these directories for nested
+117 -1
View File
@@ -1,4 +1,4 @@
{
{
"environments": [
{
"BuildDir": "${workspaceRoot}\\build",
@@ -7,9 +7,77 @@
{
"environment": "vcpkg",
"VcPkgDir": "D:/vcpkg/"
},
{
"environment": "mingw_64",
"MINGW64_ROOT": "D:/msys64/mingw64",
"BIN_ROOT": "${env.MINGW64_ROOT}/bin",
"FLAVOR": "x86_64-w64-mingw32",
"TOOLSET_VERSION": "10.2.0",
"PATH": "${env.MINGW64_ROOT}/bin;${env.MINGW64_ROOT}/../usr/local/bin;${env.MINGW64_ROOT}/../usr/bin;${env.MINGW64_ROOT}/../bin;${env.PATH}",
"INCLUDE": "${env.INCLUDE};${env.MINGW64_ROOT}/include/c++/${env.TOOLSET_VERSION};${env.MINGW64_ROOT}/include/c++/${env.TOOLSET_VERSION}/tr1;${env.MINGW64_ROOT}/include/c++/${env.TOOLSET_VERSION}/${env.FLAVOR}"
}
],
"configurations": [
{
"name": "x86-Debug",
"generator": "Ninja",
"configurationType": "Debug",
"inheritEnvironments": [ "msvc_x86", "vcpkg" ],
"buildRoot": "${env.BuildDir}\\${name}",
"installRoot": "${env.InstallDir}\\${name}",
"addressSanitizerEnabled": false,
"cmakeCommandArgs": "",
"buildCommandArgs": "-v",
"ctestCommandArgs": "",
"variables": [
{
"name": "KICAD_SPICE",
"value": "ON",
"type": "STRING"
},
{
"name": "KICAD_BUILD_QA_TESTS",
"value": "False",
"type": "BOOL"
},
{
"name": "KICAD_WIN32_DPI_AWARE",
"value": "ON",
"type": "BOOL"
}
],
"cmakeToolchain": "${env.VcPkgDir}/scripts/buildsystems/vcpkg.cmake"
},
{
"name": "x86-Release",
"generator": "Ninja",
"configurationType": "RelWithDebInfo",
"inheritEnvironments": [ "msvc_x86", "vcpkg" ],
"buildRoot": "${env.BuildDir}\\${name}",
"installRoot": "${env.InstallDir}\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "-v",
"ctestCommandArgs": "",
"variables": [
{
"name": "KICAD_SPICE",
"value": "ON",
"type": "STRING"
},
{
"name": "KICAD_BUILD_QA_TESTS",
"value": "False",
"type": "BOOL"
},
{
"name": "KICAD_WIN32_DPI_AWARE",
"value": "ON",
"type": "BOOL"
}
],
"cmakeToolchain": "${env.VcPkgDir}/scripts/buildsystems/vcpkg.cmake"
},
{
"name": "x64-Debug",
"generator": "Ninja",
@@ -21,6 +89,11 @@
"buildCommandArgs": "-v",
"ctestCommandArgs": "",
"variables": [
{
"name": "KICAD_SPICE",
"value": "ON",
"type": "STRING"
},
{
"name": "KICAD_BUILD_QA_TESTS",
"value": "False",
@@ -45,6 +118,11 @@
"buildCommandArgs": "-v",
"ctestCommandArgs": "",
"variables": [
{
"name": "KICAD_SPICE",
"value": "ON",
"type": "STRING"
},
{
"name": "KICAD_BUILD_QA_TESTS",
"value": "False",
@@ -57,6 +135,44 @@
}
],
"cmakeToolchain": "${env.VcPkgDir}/scripts/buildsystems/vcpkg.cmake"
},
{
"name": "MSYS2-x64-Debug",
"generator": "Ninja",
"configurationType": "Debug",
"inheritEnvironments": [ "mingw_64" ],
"buildRoot": "${env.BuildDir}\\${name}",
"installRoot": "${env.InstallDir}\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "-v",
"ctestCommandArgs": "",
"intelliSenseMode": "linux-gcc-x64",
"cmakeToolchain": "",
"variables": [
{
"name": "CMAKE_C_COMPILER",
"value": "${env.BIN_ROOT}/gcc.exe"
},
{
"name": "CMAKE_CXX_COMPILER",
"value": "${env.BIN_ROOT}/g++.exe"
},
{
"name": "KICAD_SPICE",
"value": "ON",
"type": "STRING"
},
{
"name": "KICAD_BUILD_QA_TESTS",
"value": "False",
"type": "BOOL"
},
{
"name": "KICAD_WIN32_DPI_AWARE",
"value": "ON",
"type": "BOOL"
}
]
}
]
}
+99 -3
View File
@@ -17,12 +17,28 @@ The parts of KiCad
Installation from binary packages
---------------------------------
Check the KiCad website for packages and installation instructions for
all supported platforms: https://kicad.org/download/
Compiled KiCad binaries exist for Windows (8.1, 10), macOS (10.14+), and several
Linux distributions (Fedora, Debian, Ubuntu, Arch). These are available from the
main KiCad website: https://kicad.org/download/
Data files (schematics, boards, libraries) are compatible with all platforms.
Installation from binary packages for Windows
---------------------------------------------
KiCad can be installed anywhere on the system as long as the user has write privileges.
Pre-made installers are available on the KiCad website: https://kicad.org/download/windows/
Installation from binary packages for Linux
-------------------------------------------
KiCad comes packaged on many Linux platforms including Debian, Fedora, Ubuntu and Arch,
and is available in their respective package repositories. More information can be found on
the platform's page at https://kicad.org/download/
Linux install tree
-------------------------------------
@@ -43,10 +59,74 @@ Linux install tree
Do not change the KiCad tree, or the location of binary files. Otherwise
KiCad may not be able to find some or all of its required files.
macOS KiCad tree
----------------
System wide files
/Library/Application Support/kicad/help
/Library/Application Support/kicad/template
/Library/Application Support/kicad/library
/Library/Application Support/kicad/modules
/Library/Application Support/kicad/3dmodels
User files can be the same as the system wide files but only inside the user's home directory.
$HOME/Library/Application Support/kicad
Warning:
These paths are hardcoded into KiCad, if you put them somewhere else KiCad will not find
them when a new project is created.
Installation from source code
-----------------------------
Current documentation for building from source can be found at: https://dev-docs.kicad.org/
Currently the only supported compilers are GCC on Linux and Windows and Clang on macOS.
Some dependencies must be satisfied for the correct installation of KiCad:
wxWidgets >= 3.0.0 http://www.wxwidgets.org/
CMake >= 3.10.0 https://www.cmake.org/
Boost C++ Libraries >= 1.59 https://www.boost.org/
OpenGL >= 2.1
Linux: Mesa 3D Graphics Library http://www.mesa3d.org/
Windows: built-in
Zlib Compression Library http://www.zlib.net/
cairo >= 1.12 http://cairographics.org/
GLEW http://glew.sourceforge.net/
libcurl http://curl.haxx.se/
OpenMP (optional) http://openmp.org/
GLM >= 9.5.4 http://glm.g-truc.net/
pkg-config http://pkgconfig.freedesktop.org/
Doxygen (optional) http://www.doxygen.nl
Python >= 2.6 (optional) https://python.org/
wxPython (optional) http://www.wxpython.org/
SWIG >= 3.0 (optional) http://swig.org/
libngspice (optional) http://ngspice.sourceforge.net/
One of:
OCE >= 0.18 (optional) https://github.com/tpaviot/oce
OCC >= 6.9.0 (optiona) https://www.opencascade.com/content/latest-release
Complete documentation for building from source can be found at: https://dev-docs.kicad.org/
Important parameters to CMake
@@ -60,8 +140,24 @@ Important parameters to CMake
-DCMAKE_INSTALL_PREFIX=<prefix>
Default to "/usr/local".
-DwxWidgets_ROOT_DIR=<wxInstallDir>
Required for Windows platform.
-DwxWidgets_USE_DEBUG=ON
Can be used only with -DCMAKE_BUILD_TYPE=Debug
-DCMAKE_CXX_FLAGS=<some extra flags>
Extra flags for the C++ compiler required for your system.
-DCMAKE_VERBOSE_MAKEFILE=ON
When more output is wanted use this cmake parameter or call "make VERBOSE=1".
Extra CFLAGS and linker flags
-----------------------------
If you require extra flags for compiler and linker you may give them via
environment variables
"CXXFLAGS" (c++ compiler)
"LDFLAGS" (for linker)
"CFLAGS" (for c-compiler, not needed in kdesvn build)
+3 -21
View File
@@ -11,40 +11,22 @@ You are free to use the *sources* under the terms of their respective licenses.
Licensed under Apache License, Version 2.0
- portions of code in libs/kimath/include/math/util.h
Licensed under BOOSTv1:
- clipper in thirdparty/clipper
- clipper2 in thirdparty/clipper2
- libcontext [https://github.com/boostorg/context] in thirdparty/libcontext
- pegtl in thirdparty/pegtl
- picosha2 in thirdparty/picosha2
- turtle in thirdparty/turtle
- clipper in thirdparty/clipper
Licensed under ISC:
- portions of code in include/geometry/polygon_triangulation.h
Licensed under MIT:
- argparse in thirdparty/argparse
- compoundfilereader in thirdparty/compoundfilereader
- delaunator in thirdparty/delaunator
- fmt in thirdparty/fmt
- json_schema_validator in thirdparty/json_schema_validator
- magic_enum in thirdparty/magic_enum
- nanodbc in thirdparty/nanodbc
- tinyspline_lib in thirdparty/tinyspline_lib
- nlohmann/json in thirdparty/nlohmann_json
- nlohmann/fifo_map in thirdparty/nlohmann_json
- pboettch/json-schema-validator in thirdparty/json_schema_validator
- picoSHA2 in thirdparty/picosha2
- rectpack2d in thirdparty/rectpack2d
- sentry-native in thirdparty/sentry-native
- thread-pool in thirdparty/thread-pool
- tinyspline_lib in thirdparty/tinyspline_lib
Licensed under MIT and BSD:
- glew in thirdparty/glew
Licensed under BSD:
- pybind11 in thirdparty/pybind11
Licensed under BSD2:
- gzip-hpp in thirdparty/gzip-hpp
Licensed under GPLv2 (or later):
- dxflib in thirdparty/dxflib_qcad
- math_for_graphics in thirdparty/other_math
- potrace in thirdparty/potrace
- math_for_graphics in thirdparty/other_math
- SutherlandHodgmanClipPoly in thirdparty/other_math
Licensed under ZLib:
- nanosvg in thirdparty/nanosvg
+2 -2
View File
@@ -49,8 +49,8 @@ GitLab CI pipeline status can be viewed for Linux and Windows builds of the late
* [plugins](plugins) - Sourcecode for the 3D viewer plugins
* [qa](qa) - Unit testing framework for KiCad
* [resources](resources) - Packaging resources such as bitmaps and operating system specific files
- [bitmaps_png](resources/bitmaps_png) - Menu and program icons
- [project_template](resources/project_template) - Project template
- [bitmaps_png](bitmaps_png) - Menu and program icons
- [project_template](project_template) - Project template
* [scripting](scripting) - Python integration for KiCad
* [thirdparty](thirdparty) - Sourcecode of external libraries used in KiCad but not written by the KiCad team
* [tools](tools) - Helpers for developing, testing and building
+17 -24
View File
@@ -4,26 +4,27 @@ if( COMPILER_SUPPORTS_WARNINGS )
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WARN_FLAGS_C}")
endif()
add_compile_definitions( BITMAP_2_CMP )
add_definitions( -DBITMAP_2_CMP )
include_directories( BEFORE ${INC_BEFORE} )
include_directories( ${INC_AFTER} )
set( BITMAP2COMPONENT_SRCS
${CMAKE_SOURCE_DIR}/common/single_top.cpp
bitmap2cmp_control.cpp
bitmap2cmp_main.cpp
bitmap2cmp_settings.cpp
bitmap2component.cpp
bitmap2cmp_panel_base.cpp
bitmap2cmp_frame.cpp
bitmap2cmp_panel.cpp
bitmap2cmp_panel_base.cpp
bitmap2cmp_gui_base.cpp
bitmap2cmp_gui.cpp
../common/env_vars.cpp # needed on MSW to avoid a link issue (a symbol not found)
)
set_source_files_properties( ${CMAKE_SOURCE_DIR}/common/single_top.cpp PROPERTIES
COMPILE_DEFINITIONS "TOP_FRAME=FRAME_BM2CMP"
)
set_source_files_properties( bitmap2cmp_gui.cpp PROPERTIES
COMPILE_DEFINITIONS "COMPILING_DLL"
)
if( WIN32 )
if( MINGW )
@@ -61,32 +62,24 @@ if( APPLE )
MACOSX_BUNDLE_INFO_PLIST ${PROJECT_BINARY_DIR}/bitmap2component/Info.plist
)
set_target_properties( bitmap2component PROPERTIES INSTALL_RPATH
"@executable_path/../Frameworks;@executable_path/../Frameworks/Python.framework" )
# put individual bundle outside of main bundle as a first step
# will be pulled into the main bundle when creating main bundle
install( TARGETS bitmap2component
DESTINATION ${KICAD_BIN}
COMPONENT binary
)
install( CODE "
set( KICAD_CMAKE_MODULE_PATH \"${KICAD_CMAKE_MODULE_PATH}\" )
set( KICAD_BIN \"${KICAD_BIN}\" )
set( OSX_BUNDLE_INSTALL_BIN_DIR \"${OSX_BUNDLE_INSTALL_BIN_DIR}\" )
set( OSX_BUNDLE_INSTALL_LIB_DIR \"${OSX_BUNDLE_INSTALL_LIB_DIR}\" )
" )
# override default embedded path settings
${OSX_BUNDLE_OVERRIDE_PATHS}
install( CODE [[
include( ${KICAD_CMAKE_MODULE_PATH}/InstallSteps/InstallMacOS.cmake )
# Install any dependencies (this will generally duplicate kicad.app but we can't be sure)
install_runtime_deps( "${KICAD_BIN}/bitmap2component.app/Contents/MacOS/bitmap2component"
""
""
# do all the work
include( BundleUtilities )
fixup_bundle( ${KICAD_BIN}/bitmap2component.app/Contents/MacOS/bitmap2component
\"\"
\"${PYTHON_FRAMEWORK}\"
)
]] )
" COMPONENT Runtime
)
else()
install( TARGETS bitmap2component
DESTINATION ${KICAD_BIN}
@@ -101,6 +94,6 @@ endif()
if( false ) # linker map with cross reference
set_target_properties( bitmap2component PROPERTIES
LINK_FLAGS "-Wl,--cref,-Map=bitmap2component.map"
LINK_FLAGS "-Wl,-cref,-Map=bitmap2component.map"
)
endif()
-62
View File
@@ -1,62 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2023 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <kiway.h>
#include <tool/tool_manager.h>
#include <tool/actions.h>
#include <bitmap2cmp_frame.h>
#include <bitmap2cmp_control.h>
bool BITMAP2CMP_CONTROL::Init()
{
Reset( MODEL_RELOAD );
return true;
}
void BITMAP2CMP_CONTROL::Reset( RESET_REASON aReason )
{
m_frame = getEditFrame<BITMAP2CMP_FRAME>();
}
int BITMAP2CMP_CONTROL::Open( const TOOL_EVENT& aEvent )
{
m_frame->OnLoadFile();
return 0;
}
int BITMAP2CMP_CONTROL::Close( const TOOL_EVENT& aEvent )
{
m_frame->Close();
return 0;
}
void BITMAP2CMP_CONTROL::setTransitions()
{
Go( &BITMAP2CMP_CONTROL::Open, ACTIONS::open.MakeEvent() );
Go( &BITMAP2CMP_CONTROL::Close, ACTIONS::quit.MakeEvent() );
}
-64
View File
@@ -1,64 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2023 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef BITMAP2CMP_CONTROL_H
#define BITMAP2CMP_CONTROL_H
#include <tool/tool_interactive.h>
class BITMAP2CMP_FRAME;
/**
* Handle actions for the various symbol editor and viewers.
*/
class BITMAP2CMP_CONTROL : public wxEvtHandler, public TOOL_INTERACTIVE
{
public:
BITMAP2CMP_CONTROL() :
TOOL_INTERACTIVE( "bitmap2cmp.Control" ),
m_frame( nullptr )
{ }
virtual ~BITMAP2CMP_CONTROL() { }
/// @copydoc TOOL_INTERACTIVE::Init()
bool Init() override;
/// @copydoc TOOL_INTERACTIVE::Reset()
void Reset( RESET_REASON aReason ) override;
int Open( const TOOL_EVENT& aEvent );
int Close( const TOOL_EVENT& aEvent );
private:
///< Set up handlers for various events.
void setTransitions() override;
private:
BITMAP2CMP_FRAME* m_frame;
};
#endif // BITMAP2CMP_CONTROL_H
-579
View File
@@ -1,579 +0,0 @@
/*
* This program source code file is part of KICAD, a free EDA CAD application.
*
* Copyright (C) 1992-2010 jean-pierre.charras
* Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <bitmap2component.h>
#include <bitmap2cmp_frame.h>
#include <bitmap2cmp_panel.h>
#include <bitmap2cmp_settings.h>
#include <bitmap_io.h>
#include <bitmaps.h>
#include <common.h>
#include <id.h>
#include <kiface_base.h>
#include <pgm_base.h>
#include <widgets/wx_menubar.h>
#include <wildcards_and_files_ext.h>
#include <file_history.h>
#include <tool/tool_manager.h>
#include <tool/tool_dispatcher.h>
#include <tool/common_control.h>
#include <bitmap2cmp_control.h>
#include <tool/actions.h>
#include <wx/filedlg.h>
#include <wx/msgdlg.h>
#define DEFAULT_DPI 300 // the image DPI used in formats that do not define a DPI
IMAGE_SIZE::IMAGE_SIZE()
{
m_outputSize = 0.0;
m_originalDPI = DEFAULT_DPI;
m_originalSizePixels = 0;
m_unit = EDA_UNITS::MILLIMETRES;
}
void IMAGE_SIZE::SetOutputSizeFromInitialImageSize()
{
// Safety-check to guarantee no divide-by-zero
m_originalDPI = std::max( 1, m_originalDPI );
// Set the m_outputSize value from the m_originalSizePixels and the selected unit
if( m_unit == EDA_UNITS::MILLIMETRES )
m_outputSize = (double)GetOriginalSizePixels() / m_originalDPI * 25.4;
else if( m_unit == EDA_UNITS::INCHES )
m_outputSize = (double)GetOriginalSizePixels() / m_originalDPI;
else
m_outputSize = m_originalDPI;
}
int IMAGE_SIZE::GetOutputDPI()
{
int outputDPI;
if( m_unit == EDA_UNITS::MILLIMETRES )
outputDPI = GetOriginalSizePixels() / ( m_outputSize / 25.4 );
else if( m_unit == EDA_UNITS::INCHES )
outputDPI = GetOriginalSizePixels() / m_outputSize;
else
outputDPI = KiROUND( m_outputSize );
// Zero is not a DPI, and may cause divide-by-zero errors...
outputDPI = std::max( 1, outputDPI );
return outputDPI;
}
void IMAGE_SIZE::SetUnit( EDA_UNITS aUnit )
{
// Set the unit used for m_outputSize, and convert the old m_outputSize value
// to the value in new unit
if( aUnit == m_unit )
return;
// Convert m_outputSize to mm:
double size_mm;
if( m_unit == EDA_UNITS::MILLIMETRES )
{
size_mm = m_outputSize;
}
else if( m_unit == EDA_UNITS::INCHES )
{
size_mm = m_outputSize * 25.4;
}
else
{
// m_outputSize is the DPI, not an image size
// the image size is m_originalSizePixels / m_outputSize (in inches)
if( m_outputSize )
size_mm = m_originalSizePixels / m_outputSize * 25.4;
else
size_mm = 0;
}
// Convert m_outputSize to new value:
if( aUnit == EDA_UNITS::MILLIMETRES )
{
m_outputSize = size_mm;
}
else if( aUnit == EDA_UNITS::INCHES )
{
m_outputSize = size_mm / 25.4;
}
else
{
if( size_mm )
m_outputSize = m_originalSizePixels / size_mm * 25.4;
else
m_outputSize = 0;
}
m_unit = aUnit;
}
BEGIN_EVENT_TABLE( BITMAP2CMP_FRAME, EDA_BASE_FRAME )
EVT_MENU( wxID_CLOSE, BITMAP2CMP_FRAME::OnExit )
EVT_MENU( wxID_EXIT, BITMAP2CMP_FRAME::OnExit )
EVT_MENU_RANGE( ID_FILE1, ID_FILEMAX, BITMAP2CMP_FRAME::OnFileHistory )
EVT_MENU( ID_FILE_LIST_CLEAR, BITMAP2CMP_FRAME::OnClearFileHistory )
END_EVENT_TABLE()
BITMAP2CMP_FRAME::BITMAP2CMP_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
KIWAY_PLAYER( aKiway, aParent, FRAME_BM2CMP, _( "Image Converter" ), wxDefaultPosition,
wxDefaultSize, wxDEFAULT_FRAME_STYLE, wxT( "bitmap2cmp" ), unityScale ),
m_panel( nullptr ),
m_statusBar( nullptr )
{
m_aboutTitle = _HKI( "KiCad Image Converter" );
// Give an icon
wxIcon icon;
wxIconBundle icon_bundle;
icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_bitmap2component, 48 ) );
icon_bundle.AddIcon( icon );
icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_bitmap2component, 128 ) );
icon_bundle.AddIcon( icon );
icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_bitmap2component, 256 ) );
icon_bundle.AddIcon( icon );
icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_bitmap2component_32 ) );
icon_bundle.AddIcon( icon );
icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_bitmap2component_16 ) );
icon_bundle.AddIcon( icon );
SetIcons( icon_bundle );
wxBoxSizer* mainSizer = new wxBoxSizer( wxVERTICAL );
SetSizer( mainSizer );
m_panel = new BITMAP2CMP_PANEL( this );
mainSizer->Add( m_panel, 1, wxEXPAND, 5 );
m_statusBar = this->CreateStatusBar( 1, wxSTB_SIZEGRIP, wxID_ANY );
LoadSettings( config() );
m_toolManager = new TOOL_MANAGER;
m_toolManager->SetEnvironment( nullptr, nullptr, nullptr, config(), this );
m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager );
// Register tools
m_toolManager->RegisterTool( new COMMON_CONTROL );
m_toolManager->RegisterTool( new BITMAP2CMP_CONTROL );
m_toolManager->InitTools();
ReCreateMenuBar();
GetSizer()->SetSizeHints( this );
SetSize( m_framePos.x, m_framePos.y, m_frameSize.x, m_frameSize.y );
if ( m_framePos == wxDefaultPosition )
Centre();
}
BITMAP2CMP_FRAME::~BITMAP2CMP_FRAME()
{
SaveSettings( config() );
/*
* This needed for OSX: avoids further OnDraw processing after this
* destructor and before the native window is destroyed
*/
Freeze();
}
void BITMAP2CMP_FRAME::OnExit( wxCommandEvent& aEvent )
{
// Just generate a wxCloseEvent
Close( false );
}
wxWindow* BITMAP2CMP_FRAME::GetToolCanvas() const
{
return m_panel->GetCurrentPage();
}
void BITMAP2CMP_FRAME::OnFileHistory( wxCommandEvent& event )
{
wxString fn = GetFileFromHistory( event.GetId(), _( "Image files" ) );
if( !fn.IsEmpty() )
{
OpenProjectFiles( std::vector<wxString>( 1, fn ) );
Refresh();
}
}
void BITMAP2CMP_FRAME::OnClearFileHistory( wxCommandEvent& aEvent )
{
ClearFileHistory();
}
void BITMAP2CMP_FRAME::doReCreateMenuBar()
{
COMMON_CONTROL* tool = m_toolManager->GetTool<COMMON_CONTROL>();
EDA_BASE_FRAME* base_frame = dynamic_cast<EDA_BASE_FRAME*>( this );
// base_frame == nullptr should not happen, but it makes Coverity happy
wxCHECK( base_frame, /* void */ );
// wxWidgets handles the OSX Application menu behind the scenes, but that means
// we always have to start from scratch with a new wxMenuBar.
wxMenuBar* oldMenuBar = base_frame->GetMenuBar();
WX_MENUBAR* menuBar = new WX_MENUBAR();
//-- File menu -----------------------------------------------------------
//
ACTION_MENU* fileMenu = new ACTION_MENU( false, tool );
fileMenu->Add( ACTIONS::open );
static ACTION_MENU* openRecentMenu;
FILE_HISTORY& fileHistory = GetFileHistory();
// Create the menu if it does not exist. Adding a file to/from the history
// will automatically refresh the menu.
if( !openRecentMenu )
{
openRecentMenu = new ACTION_MENU( false, tool );
openRecentMenu->SetIcon( BITMAPS::recent );
fileHistory.UseMenu( openRecentMenu );
fileHistory.AddFilesToMenu();
}
// Ensure the title is up to date after changing language
openRecentMenu->SetTitle( _( "Open Recent" ) );
fileHistory.UpdateClearText( openRecentMenu, _( "Clear Recent Files" ) );
wxMenuItem* item = fileMenu->Add( openRecentMenu->Clone() );
// Add the file menu condition here since it needs the item ID for the submenu
ACTION_CONDITIONS cond;
cond.Enable( FILE_HISTORY::FileHistoryNotEmpty( fileHistory ) );
RegisterUIUpdateHandler( item->GetId(), cond );
fileMenu->AppendSeparator();
fileMenu->AddQuit( _( "Image Converter" ) );
//-- Preferences menu -----------------------------------------------
//
ACTION_MENU* prefsMenu = new ACTION_MENU( false, tool );
prefsMenu->Add( ACTIONS::openPreferences );
prefsMenu->AppendSeparator();
AddMenuLanguageList( prefsMenu, tool );
//-- Menubar -------------------------------------------------------------
//
menuBar->Append( fileMenu, _( "&File" ) );
menuBar->Append( prefsMenu, _( "&Preferences" ) );
base_frame->AddStandardHelpMenu( menuBar );
base_frame->SetMenuBar( menuBar );
delete oldMenuBar;
}
void BITMAP2CMP_FRAME::ShowChangedLanguage()
{
EDA_BASE_FRAME::ShowChangedLanguage();
UpdateTitle();
SaveSettings( config() );
IMAGE_SIZE imageSizeX = m_panel->GetOutputSizeX();
IMAGE_SIZE imageSizeY = m_panel->GetOutputSizeY();
Freeze();
wxSizer* mainSizer = m_panel->GetContainingSizer();
mainSizer->Detach( m_panel );
m_panel->Destroy();
m_panel = new BITMAP2CMP_PANEL( this );
mainSizer->Add( m_panel, 1, wxEXPAND, 5 );
Layout();
if( !m_bitmapFileName.IsEmpty() )
OpenProjectFiles( std::vector<wxString>( 1, m_bitmapFileName ) );
LoadSettings( config() );
m_panel->SetOutputSize( imageSizeX, imageSizeY );
Thaw();
Refresh();
}
void BITMAP2CMP_FRAME::UpdateTitle()
{
wxString title;
if( !m_bitmapFileName.IsEmpty() )
{
wxFileName filename( m_bitmapFileName );
title = filename.GetFullName() + wxT( " \u2014 " );
}
title += _( "Image Converter" );
SetTitle( title );
}
void BITMAP2CMP_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
{
EDA_BASE_FRAME::LoadSettings( aCfg );
BITMAP2CMP_SETTINGS* cfg = dynamic_cast<BITMAP2CMP_SETTINGS*>( aCfg );
if( cfg )
{
m_bitmapFileName = cfg->m_BitmapFileName;
m_convertedFileName = cfg->m_ConvertedFileName;
m_panel->LoadSettings( cfg );
}
}
void BITMAP2CMP_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
{
EDA_BASE_FRAME::SaveSettings( aCfg );
BITMAP2CMP_SETTINGS* cfg = dynamic_cast<BITMAP2CMP_SETTINGS*>( aCfg );
if( cfg )
{
cfg->m_BitmapFileName = m_bitmapFileName;
cfg->m_ConvertedFileName = m_convertedFileName;
m_panel->SaveSettings( cfg );
}
}
void BITMAP2CMP_FRAME::OnLoadFile()
{
wxFileName fn( m_bitmapFileName );
wxString path = fn.GetPath();
if( path.IsEmpty() || !wxDirExists( path ) )
path = m_mruPath;
wxFileDialog fileDlg( this, _( "Choose Image" ), path, wxEmptyString,
_( "Image Files" ) + wxS( " " )+ wxImage::GetImageExtWildcard(),
wxFD_OPEN | wxFD_FILE_MUST_EXIST );
int diag = fileDlg.ShowModal();
if( diag != wxID_OK )
return;
wxString fullFilename = fileDlg.GetPath();
if( !OpenProjectFiles( std::vector<wxString>( 1, fullFilename ) ) )
return;
fn = fullFilename;
m_mruPath = fn.GetPath();
SetStatusText( fullFilename );
UpdateTitle();
Refresh();
}
bool BITMAP2CMP_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl )
{
m_bitmapFileName = aFileSet[0];
if( m_panel->OpenProjectFiles( aFileSet, aCtl ) )
{
UpdateFileHistory( m_bitmapFileName );
return true;
}
return false;
}
void BITMAP2CMP_FRAME::ExportDrawingSheetFormat()
{
wxFileName fn( m_convertedFileName );
wxString path = fn.GetPath();
if( path.IsEmpty() || !wxDirExists(path) )
path = ::wxGetCwd();
wxFileDialog fileDlg( this, _( "Create Drawing Sheet File" ), path, wxEmptyString,
FILEEXT::DrawingSheetFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
int diag = fileDlg.ShowModal();
if( diag != wxID_OK )
return;
fn = fileDlg.GetPath();
fn.SetExt( FILEEXT::DrawingSheetFileExtension );
m_convertedFileName = fn.GetFullPath();
FILE* outfile;
outfile = wxFopen( m_convertedFileName, wxT( "w" ) );
if( outfile == nullptr )
{
wxString msg;
msg.Printf( _( "File '%s' could not be created." ), m_convertedFileName );
wxMessageBox( msg );
return;
}
std::string buffer;
m_panel->ExportToBuffer( buffer, KICAD_WKS_LOGO );
fputs( buffer.c_str(), outfile );
fclose( outfile );
}
void BITMAP2CMP_FRAME::ExportPostScriptFormat()
{
wxFileName fn( m_convertedFileName );
wxString path = fn.GetPath();
if( path.IsEmpty() || !wxDirExists( path ) )
path = ::wxGetCwd();
wxFileDialog fileDlg( this, _( "Create PostScript File" ), path, wxEmptyString,
FILEEXT::PSFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
if( fileDlg.ShowModal() != wxID_OK )
return;
fn = fileDlg.GetPath();
fn.SetExt( wxT( "ps" ) );
m_convertedFileName = fn.GetFullPath();
FILE* outfile;
outfile = wxFopen( m_convertedFileName, wxT( "w" ) );
if( outfile == nullptr )
{
wxString msg;
msg.Printf( _( "File '%s' could not be created." ), m_convertedFileName );
wxMessageBox( msg );
return;
}
std::string buffer;
m_panel->ExportToBuffer( buffer, POSTSCRIPT_FMT );
fputs( buffer.c_str(), outfile );
fclose( outfile );
}
void BITMAP2CMP_FRAME::ExportEeschemaFormat()
{
wxFileName fn( m_convertedFileName );
wxString path = fn.GetPath();
if( path.IsEmpty() || !wxDirExists(path) )
path = ::wxGetCwd();
wxFileDialog fileDlg( this, _( "Create Symbol Library" ), path, wxEmptyString,
FILEEXT::KiCadSymbolLibFileWildcard(),
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
if( fileDlg.ShowModal() != wxID_OK )
return;
fn = EnsureFileExtension( fileDlg.GetPath(), FILEEXT::KiCadSymbolLibFileExtension );
m_convertedFileName = fn.GetFullPath();
FILE* outfile = wxFopen( m_convertedFileName, wxT( "w" ) );
if( outfile == nullptr )
{
wxString msg;
msg.Printf( _( "File '%s' could not be created." ), m_convertedFileName );
wxMessageBox( msg );
return;
}
std::string buffer;
m_panel->ExportToBuffer( buffer, EESCHEMA_FMT );
fputs( buffer.c_str(), outfile );
fclose( outfile );
}
void BITMAP2CMP_FRAME::ExportPcbnewFormat()
{
wxFileName fn( m_convertedFileName );
wxString path = fn.GetPath();
if( path.IsEmpty() || !wxDirExists( path ) )
path = m_mruPath;
wxFileDialog fileDlg( this, _( "Create Footprint Library" ), path, wxEmptyString,
FILEEXT::KiCadFootprintLibFileWildcard(),
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
if( fileDlg.ShowModal() != wxID_OK )
return;
fn = EnsureFileExtension( fileDlg.GetPath(), FILEEXT::KiCadFootprintFileExtension );
m_convertedFileName = fn.GetFullPath();
FILE* outfile = wxFopen( m_convertedFileName, wxT( "w" ) );
if( outfile == nullptr )
{
wxString msg;
msg.Printf( _( "File '%s' could not be created." ), m_convertedFileName );
wxMessageBox( msg );
return;
}
std::string buffer;
m_panel->ExportToBuffer( buffer, PCBNEW_KICAD_MOD );
fputs( buffer.c_str(), outfile );
fclose( outfile );
m_mruPath = fn.GetPath();
}
-95
View File
@@ -1,95 +0,0 @@
/*
* This program source code file is part of KICAD, a free EDA CAD application.
*
* Copyright (C) 2019-2023 Kicad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef BITMOP2CMP_GUI_H_
#define BITMOP2CMP_GUI_H_
#include <kiway_player.h>
#include <bitmap2cmp_frame.h>
#include <eda_units.h>
#include <potracelib.h>
class BITMAP2CMP_PANEL;
class BITMAP2CMP_FRAME : public KIWAY_PLAYER
{
public:
BITMAP2CMP_FRAME( KIWAY* aKiway, wxWindow* aParent );
~BITMAP2CMP_FRAME();
// overload KIWAY_PLAYER virtual
bool OpenProjectFiles( const std::vector<wxString>& aFilenames, int aCtl = 0 ) override;
void OnLoadFile();
void OnFileHistory( wxCommandEvent& event );
void OnClearFileHistory( wxCommandEvent& event );
/**
* Generate a schematic library which contains one component:
* the logo
*/
void ExportEeschemaFormat();
/**
* Generate a footprint in S expr format
*/
void ExportPcbnewFormat();
/**
* Generate a postscript file
*/
void ExportPostScriptFormat();
/**
* Generate a file suitable to be copied into a drawing sheet (.kicad_wks) file
*/
void ExportDrawingSheetFormat();
void UpdateTitle();
void ShowChangedLanguage() override;
void LoadSettings( APP_SETTINGS_BASE* aCfg ) override;
void SaveSettings( APP_SETTINGS_BASE* aCfg ) override;
wxWindow* GetToolCanvas() const override;
/**
* Event handler for the wxID_EXIT and wxID_CLOSE events.
*/
void OnExit( wxCommandEvent& aEvent );
protected:
void doReCreateMenuBar() override;
DECLARE_EVENT_TABLE();
private:
BITMAP2CMP_PANEL* m_panel;
wxStatusBar* m_statusBar;
wxString m_bitmapFileName;
wxString m_convertedFileName;
};
#endif// BITMOP2CMP_GUI_H_
+922
View File
@@ -0,0 +1,922 @@
/*
* This program source code file is part of KICAD, a free EDA CAD application.
*
* Copyright (C) 1992-2010 jean-pierre.charras
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "bitmap2cmp_gui.h"
#include "bitmap2component.h"
#include <bitmap2cmp_settings.h>
#include <bitmap_io.h>
#include <bitmaps.h>
#include <kiface_base.h>
#include <math/util.h> // for KiROUND
#include <kiway.h>
#include <potracelib.h>
#include <wildcards_and_files_ext.h>
#include <tool/tool_manager.h>
#include <tool/common_control.h>
#include <wx/clipbrd.h>
#include <wx/rawbmp.h>
#include <wx/filedlg.h>
#include <wx/msgdlg.h>
#include <wx/dcclient.h>
#include <wx/log.h>
#include "bitmap2cmp_gui_base.h"
#include "pgm_base.h"
#define DEFAULT_DPI 300 // the image DPI used in formats that do not define a DPI
IMAGE_SIZE::IMAGE_SIZE()
{
m_outputSize = 0.0;
m_originalDPI = DEFAULT_DPI;
m_originalSizePixels = 0;
m_unit = EDA_UNITS::MILLIMETRES;
}
void IMAGE_SIZE::SetOutputSizeFromInitialImageSize()
{
// Safety-check to guarantee no divide-by-zero
m_originalDPI = std::max( 1, m_originalDPI );
// Set the m_outputSize value from the m_originalSizePixels and the selected unit
if( m_unit == EDA_UNITS::MILLIMETRES )
m_outputSize = (double)GetOriginalSizePixels() / m_originalDPI * 25.4;
else if( m_unit == EDA_UNITS::INCHES )
m_outputSize = (double)GetOriginalSizePixels() / m_originalDPI;
else
m_outputSize = m_originalDPI;
}
int IMAGE_SIZE::GetOutputDPI()
{
int outputDPI;
if( m_unit == EDA_UNITS::MILLIMETRES )
outputDPI = GetOriginalSizePixels() / ( m_outputSize / 25.4 );
else if( m_unit == EDA_UNITS::INCHES )
outputDPI = GetOriginalSizePixels() / m_outputSize;
else
outputDPI = KiROUND( m_outputSize );
// Zero is not a DPI, and may cause divide-by-zero errors...
outputDPI = std::max( 1, outputDPI );
return outputDPI;
}
void IMAGE_SIZE::SetUnit( EDA_UNITS aUnit )
{
// Set the unit used for m_outputSize, and convert the old m_outputSize value
// to the value in new unit
if( aUnit == m_unit )
return;
// Convert m_outputSize to mm:
double size_mm;
if( m_unit == EDA_UNITS::MILLIMETRES )
{
size_mm = m_outputSize;
}
else if( m_unit == EDA_UNITS::INCHES )
{
size_mm = m_outputSize * 25.4;
}
else
{
// m_outputSize is the DPI, not an image size
// the image size is m_originalSizePixels / m_outputSize (in inches)
if( m_outputSize )
size_mm = m_originalSizePixels / m_outputSize * 25.4;
else
size_mm = 0;
}
// Convert m_outputSize to new value:
if( aUnit == EDA_UNITS::MILLIMETRES )
{
m_outputSize = size_mm;
}
else if( aUnit == EDA_UNITS::INCHES )
{
m_outputSize = size_mm / 25.4;
}
else
{
if( size_mm )
m_outputSize = m_originalSizePixels / size_mm * 25.4;
else
m_outputSize = 0;
}
m_unit = aUnit;
}
BEGIN_EVENT_TABLE( BM2CMP_FRAME, BM2CMP_FRAME_BASE )
EVT_MENU( wxID_EXIT, BM2CMP_FRAME::OnExit )
EVT_MENU( wxID_OPEN, BM2CMP_FRAME::OnLoadFile )
END_EVENT_TABLE()
BM2CMP_FRAME::BM2CMP_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
BM2CMP_FRAME_BASE( aParent )
{
m_ident = FRAME_BM2CMP; // Initialized to wxID_ANY by wxFormBuilder
SetKiway( this, aKiway );
for( wxString unit : { _( "mm" ), _( "Inch" ), _( "DPI" ) } )
m_PixelUnit->Append( unit );
LoadSettings( config() );
m_outputSizeX.SetUnit( getUnitFromSelection() );
m_outputSizeY.SetUnit( getUnitFromSelection() );
m_outputSizeX.SetOutputSize( 0, getUnitFromSelection() );
m_outputSizeY.SetOutputSize( 0, getUnitFromSelection() );
m_UnitSizeX->ChangeValue( FormatOutputSize( m_outputSizeX.GetOutputSize() ) );
m_UnitSizeY->ChangeValue( FormatOutputSize( m_outputSizeY.GetOutputSize() ) );
// Give an icon
wxIcon icon;
wxIconBundle icon_bundle;
icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_bitmap2component ) );
icon_bundle.AddIcon( icon );
icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_bitmap2component_32 ) );
icon_bundle.AddIcon( icon );
icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_bitmap2component_16 ) );
icon_bundle.AddIcon( icon );
SetIcons( icon_bundle );
ReCreateMenuBar();
GetSizer()->SetSizeHints( this );
m_buttonExportFile->Enable( false );
m_buttonExportClipboard->Enable( false );
SetSize( m_framePos.x, m_framePos.y, m_frameSize.x, m_frameSize.y );
if ( m_framePos == wxDefaultPosition )
Centre();
}
BM2CMP_FRAME::~BM2CMP_FRAME()
{
SaveSettings( config() );
/*
* This needed for OSX: avoids further OnDraw processing after this
* destructor and before the native window is destroyed
*/
Freeze();
}
wxWindow* BM2CMP_FRAME::GetToolCanvas() const
{
return m_Notebook->GetCurrentPage();
}
void BM2CMP_FRAME::doReCreateMenuBar()
{
// wxWidgets handles the Mac Application menu behind the scenes, but that means
// we always have to start from scratch with a new wxMenuBar.
wxMenuBar* oldMenuBar = GetMenuBar();
wxMenuBar* menuBar = new wxMenuBar();
wxMenu* fileMenu = new wxMenu;
wxMenuItem* item = new wxMenuItem( fileMenu, wxID_OPEN, _( "Open..." ) + wxT( "\tCtrl+O" ),
_( "Load source image" ) );
fileMenu->Append( item );
#ifndef __WXMAC__
// Mac moves Quit to the App menu so we don't need a separator on Mac
fileMenu->AppendSeparator();
#endif
item = new wxMenuItem( fileMenu, wxID_EXIT, _( "Quit" ) + wxT( "\tCtrl+Q" ),
_( "Quit Image Converter" ) );
if( Pgm().GetCommonSettings()->m_Appearance.use_icons_in_menus )
item->SetBitmap( KiBitmap( BITMAPS::exit ) );
fileMenu->Append( item );
menuBar->Append( fileMenu, _( "&File" ) );
SetMenuBar( menuBar );
delete oldMenuBar;
}
void BM2CMP_FRAME::OnExit( wxCommandEvent& event )
{
Destroy();
}
void BM2CMP_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
{
EDA_BASE_FRAME::LoadSettings( aCfg );
BITMAP2CMP_SETTINGS* cfg = static_cast<BITMAP2CMP_SETTINGS*>( aCfg );
m_BitmapFileName = cfg->m_BitmapFileName;
m_ConvertedFileName = cfg->m_ConvertedFileName;
int u_select = cfg->m_Units;
if( u_select < 0 || u_select > 2 ) // Validity control
u_select = 0;
m_PixelUnit->SetSelection( u_select );
m_sliderThreshold->SetValue( cfg->m_Threshold );
m_Negative = cfg->m_Negative;
m_checkNegative->SetValue( cfg->m_Negative );
m_AspectRatio = 1.0;
m_aspectRatioCheckbox->SetValue( true );
int format = cfg->m_LastFormat;
if( format < 0 || format > FINAL_FMT )
format = PCBNEW_KICAD_MOD;
m_rbOutputFormat->SetSelection( format );
if( format == PCBNEW_KICAD_MOD )
m_rbPCBLayer->Enable( true );
else
m_rbPCBLayer->Enable( false );
int last_layer = cfg->m_LastModLayer;
if( last_layer > static_cast<int>( MOD_LYR_FINAL ) ) // Out of range
m_rbPCBLayer->SetSelection( MOD_LYR_FSILKS );
else
m_rbPCBLayer->SetSelection( last_layer );
}
void BM2CMP_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
{
EDA_BASE_FRAME::SaveSettings( aCfg );
BITMAP2CMP_SETTINGS* cfg = static_cast<BITMAP2CMP_SETTINGS*>( aCfg );
cfg->m_BitmapFileName = m_BitmapFileName;
cfg->m_ConvertedFileName = m_ConvertedFileName;
cfg->m_Threshold = m_sliderThreshold->GetValue();
cfg->m_Negative = m_checkNegative->IsChecked();
cfg->m_LastFormat = m_rbOutputFormat->GetSelection();
cfg->m_LastModLayer = m_rbPCBLayer->GetSelection();
cfg->m_Units = m_PixelUnit->GetSelection();
}
void BM2CMP_FRAME::OnPaintInit( wxPaintEvent& event )
{
#ifdef __WXMAC__
// Otherwise fails due: using wxPaintDC without being in a native paint event
wxClientDC pict_dc( m_InitialPicturePanel );
#else
wxPaintDC pict_dc( m_InitialPicturePanel );
#endif
m_InitialPicturePanel->PrepareDC( pict_dc );
// OSX crashes with empty bitmaps (on initial refreshes)
if( m_Pict_Bitmap.IsOk() )
pict_dc.DrawBitmap( m_Pict_Bitmap, 0, 0, !!m_Pict_Bitmap.GetMask() );
event.Skip();
}
void BM2CMP_FRAME::OnPaintGreyscale( wxPaintEvent& event )
{
#ifdef __WXMAC__
// Otherwise fails due: using wxPaintDC without being in a native paint event
wxClientDC greyscale_dc( m_GreyscalePicturePanel );
#else
wxPaintDC greyscale_dc( m_GreyscalePicturePanel );
#endif
m_GreyscalePicturePanel->PrepareDC( greyscale_dc );
// OSX crashes with empty bitmaps (on initial refreshes)
if( m_Greyscale_Bitmap.IsOk() )
greyscale_dc.DrawBitmap( m_Greyscale_Bitmap, 0, 0, !!m_Greyscale_Bitmap.GetMask() );
event.Skip();
}
void BM2CMP_FRAME::OnPaintBW( wxPaintEvent& event )
{
#ifdef __WXMAC__
// Otherwise fails due: using wxPaintDC without being in a native paint event
wxClientDC nb_dc( m_BNPicturePanel );
#else
wxPaintDC nb_dc( m_BNPicturePanel );
#endif
m_BNPicturePanel->PrepareDC( nb_dc );
if( m_BN_Bitmap.IsOk() )
nb_dc.DrawBitmap( m_BN_Bitmap, 0, 0, !!m_BN_Bitmap.GetMask() );
event.Skip();
}
void BM2CMP_FRAME::OnLoadFile( wxCommandEvent& event )
{
wxFileName fn( m_BitmapFileName );
wxString path = fn.GetPath();
if( path.IsEmpty() || !wxDirExists( path ) )
path = m_mruPath;
wxFileDialog fileDlg( this, _( "Choose Image" ), path, wxEmptyString,
_( "Image Files" ) + wxS( " " )+ wxImage::GetImageExtWildcard(),
wxFD_OPEN | wxFD_FILE_MUST_EXIST );
int diag = fileDlg.ShowModal();
if( diag != wxID_OK )
return;
wxString fullFilename = fileDlg.GetPath();
if( !OpenProjectFiles( std::vector<wxString>( 1, fullFilename ) ) )
return;
fn = fullFilename;
m_mruPath = fn.GetPath();
SetStatusText( fullFilename );
Refresh();
}
bool BM2CMP_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl )
{
m_Pict_Image.Destroy();
m_BitmapFileName = aFileSet[0];
if( !m_Pict_Image.LoadFile( m_BitmapFileName ) )
{
// LoadFile has its own UI, no need for further failure notification here
return false;
}
m_Pict_Bitmap = wxBitmap( m_Pict_Image );
// Determine image resolution in DPI (does not existing in all formats).
// the resolution can be given in bit per inches or bit per cm in file
int imageDPIx = m_Pict_Image.GetOptionInt( wxIMAGE_OPTION_RESOLUTIONX );
int imageDPIy = m_Pict_Image.GetOptionInt( wxIMAGE_OPTION_RESOLUTIONY );
if( imageDPIx > 1 && imageDPIy > 1 )
{
if( m_Pict_Image.GetOptionInt( wxIMAGE_OPTION_RESOLUTIONUNIT ) == wxIMAGE_RESOLUTION_CM )
{
imageDPIx = KiROUND( imageDPIx * 2.54 );
imageDPIy = KiROUND( imageDPIy * 2.54 );
}
}
else // fallback to a default value (DEFAULT_DPI)
{
imageDPIx = imageDPIy = DEFAULT_DPI;
}
m_InputXValueDPI->SetLabel( wxString::Format( wxT( "%d" ), imageDPIx ) );
m_InputYValueDPI->SetLabel( wxString::Format( wxT( "%d" ), imageDPIy ) );
int h = m_Pict_Bitmap.GetHeight();
int w = m_Pict_Bitmap.GetWidth();
m_AspectRatio = (double) w / h;
m_outputSizeX.SetOriginalDPI( imageDPIx );
m_outputSizeX.SetOriginalSizePixels( w );
m_outputSizeY.SetOriginalDPI( imageDPIy );
m_outputSizeY.SetOriginalSizePixels( h );
// Update display to keep aspect ratio
wxCommandEvent dummy;
OnSizeChangeX( dummy );
updateImageInfo();
m_InitialPicturePanel->SetVirtualSize( w, h );
m_GreyscalePicturePanel->SetVirtualSize( w, h );
m_BNPicturePanel->SetVirtualSize( w, h );
m_Greyscale_Image.Destroy();
m_Greyscale_Image = m_Pict_Image.ConvertToGreyscale( );
if( m_Pict_Bitmap.GetMask() )
{
for( int x = 0; x < m_Pict_Bitmap.GetWidth(); x++ )
{
for( int y = 0; y < m_Pict_Bitmap.GetHeight(); y++ )
{
if( m_Pict_Image.GetRed( x, y ) == m_Pict_Image.GetMaskRed() &&
m_Pict_Image.GetGreen( x, y ) == m_Pict_Image.GetMaskGreen() &&
m_Pict_Image.GetBlue( x, y ) == m_Pict_Image.GetMaskBlue() )
{
m_Greyscale_Image.SetRGB( x, y, 255, 255, 255 );
}
}
}
}
if( m_Negative )
NegateGreyscaleImage( );
m_Greyscale_Bitmap = wxBitmap( m_Greyscale_Image );
m_NB_Image = m_Greyscale_Image;
Binarize( (double) m_sliderThreshold->GetValue() / m_sliderThreshold->GetMax() );
m_buttonExportFile->Enable( true );
m_buttonExportClipboard->Enable( true );
m_outputSizeX.SetOutputSizeFromInitialImageSize();
m_UnitSizeX->ChangeValue( FormatOutputSize( m_outputSizeX.GetOutputSize() ) );
m_outputSizeY.SetOutputSizeFromInitialImageSize();
m_UnitSizeY->ChangeValue( FormatOutputSize( m_outputSizeY.GetOutputSize() ) );
return true;
}
// return a string giving the output size, according to the selected unit
wxString BM2CMP_FRAME::FormatOutputSize( double aSize )
{
wxString text;
if( getUnitFromSelection() == EDA_UNITS::MILLIMETRES )
text.Printf( wxS( "%.1f" ), aSize );
else if( getUnitFromSelection() == EDA_UNITS::INCHES )
text.Printf( wxS( "%.2f" ), aSize );
else
text.Printf( wxT( "%d" ), KiROUND( aSize ) );
return text;
}
void BM2CMP_FRAME::updateImageInfo()
{
// Note: the image resolution text controls are not modified here, to avoid a race between
// text change when entered by user and a text change if it is modified here.
if( m_Pict_Bitmap.IsOk() )
{
int h = m_Pict_Bitmap.GetHeight();
int w = m_Pict_Bitmap.GetWidth();
int nb = m_Pict_Bitmap.GetDepth();
m_SizeXValue->SetLabel( wxString::Format( wxT( "%d" ), w ) );
m_SizeYValue->SetLabel( wxString::Format( wxT( "%d" ), h ) );
m_BPPValue->SetLabel( wxString::Format( wxT( "%d" ), nb ) );
}
}
EDA_UNITS BM2CMP_FRAME::getUnitFromSelection()
{
// return the EDA_UNITS from the m_PixelUnit choice
switch( m_PixelUnit->GetSelection() )
{
case 1: return EDA_UNITS::INCHES;
case 2: return EDA_UNITS::UNSCALED;
case 0:
default: return EDA_UNITS::MILLIMETRES;
}
}
void BM2CMP_FRAME::OnSizeChangeX( wxCommandEvent& event )
{
double new_size;
if( m_UnitSizeX->GetValue().ToDouble( &new_size ) )
{
if( m_aspectRatioCheckbox->GetValue() )
{
double calculatedY = new_size / m_AspectRatio;
if( getUnitFromSelection() == EDA_UNITS::UNSCALED )
{
// for units in DPI, keeping aspect ratio cannot use m_AspectRatioLocked.
// just re-scale the other dpi
double ratio = new_size / m_outputSizeX.GetOutputSize();
calculatedY = m_outputSizeY.GetOutputSize() * ratio;
}
m_outputSizeY.SetOutputSize( calculatedY, getUnitFromSelection() );
m_UnitSizeY->ChangeValue( FormatOutputSize( m_outputSizeY.GetOutputSize() ) );
}
m_outputSizeX.SetOutputSize( new_size, getUnitFromSelection() );
}
updateImageInfo();
}
void BM2CMP_FRAME::OnSizeChangeY( wxCommandEvent& event )
{
double new_size;
if( m_UnitSizeY->GetValue().ToDouble( &new_size ) )
{
if( m_aspectRatioCheckbox->GetValue() )
{
double calculatedX = new_size * m_AspectRatio;
if( getUnitFromSelection() == EDA_UNITS::UNSCALED )
{
// for units in DPI, keeping aspect ratio cannot use m_AspectRatioLocked.
// just re-scale the other dpi
double ratio = new_size / m_outputSizeX.GetOutputSize();
calculatedX = m_outputSizeX.GetOutputSize() * ratio;
}
m_outputSizeX.SetOutputSize( calculatedX, getUnitFromSelection() );
m_UnitSizeX->ChangeValue( FormatOutputSize( m_outputSizeX.GetOutputSize() ) );
}
m_outputSizeY.SetOutputSize( new_size, getUnitFromSelection() );
}
updateImageInfo();
}
void BM2CMP_FRAME::OnSizeUnitChange( wxCommandEvent& event )
{
m_outputSizeX.SetUnit( getUnitFromSelection() );
m_outputSizeY.SetUnit( getUnitFromSelection() );
updateImageInfo();
m_UnitSizeX->ChangeValue( FormatOutputSize( m_outputSizeX.GetOutputSize() ) );
m_UnitSizeY->ChangeValue( FormatOutputSize( m_outputSizeY.GetOutputSize() ) );
}
void BM2CMP_FRAME::ToggleAspectRatioLock( wxCommandEvent& event )
{
if( m_aspectRatioCheckbox->GetValue() )
{
// Force display update when aspect ratio is locked
wxCommandEvent dummy;
OnSizeChangeX( dummy );
}
}
void BM2CMP_FRAME::Binarize( double aThreshold )
{
int h = m_Greyscale_Image.GetHeight();
int w = m_Greyscale_Image.GetWidth();
unsigned char threshold = aThreshold * 255;
unsigned char alpha_thresh = 0.7 * threshold;
for( int y = 0; y < h; y++ )
{
for( int x = 0; x < w; x++ )
{
unsigned char pixout;
unsigned char pixin = m_Greyscale_Image.GetGreen( x, y );
unsigned char alpha = m_Greyscale_Image.HasAlpha() ? m_Greyscale_Image.GetAlpha( x, y )
: wxALPHA_OPAQUE;
if( pixin < threshold && alpha > alpha_thresh )
pixout = 0;
else
pixout = 255;
m_NB_Image.SetRGB( x, y, pixout, pixout, pixout );
}
}
m_BN_Bitmap = wxBitmap( m_NB_Image );
}
void BM2CMP_FRAME::NegateGreyscaleImage( )
{
unsigned char pix;
int h = m_Greyscale_Image.GetHeight();
int w = m_Greyscale_Image.GetWidth();
for( int y = 0; y < h; y++ )
{
for( int x = 0; x < w; x++ )
{
pix = m_Greyscale_Image.GetGreen( x, y );
pix = ~pix;
m_Greyscale_Image.SetRGB( x, y, pix, pix, pix );
}
}
}
void BM2CMP_FRAME::OnNegativeClicked( wxCommandEvent& )
{
if( m_checkNegative->GetValue() != m_Negative )
{
NegateGreyscaleImage();
m_Greyscale_Bitmap = wxBitmap( m_Greyscale_Image );
Binarize( (double)m_sliderThreshold->GetValue()/m_sliderThreshold->GetMax() );
m_Negative = m_checkNegative->GetValue();
Refresh();
}
}
void BM2CMP_FRAME::OnThresholdChange( wxScrollEvent& event )
{
Binarize( (double)m_sliderThreshold->GetValue()/m_sliderThreshold->GetMax() );
Refresh();
}
void BM2CMP_FRAME::OnExportToFile( wxCommandEvent& event )
{
// choices of m_rbOutputFormat are expected to be in same order as
// OUTPUT_FMT_ID. See bitmap2component.h
OUTPUT_FMT_ID format = (OUTPUT_FMT_ID) m_rbOutputFormat->GetSelection();
exportBitmap( format );
}
void BM2CMP_FRAME::OnExportToClipboard( wxCommandEvent& event )
{
// choices of m_rbOutputFormat are expected to be in same order as
// OUTPUT_FMT_ID. See bitmap2component.h
OUTPUT_FMT_ID format = (OUTPUT_FMT_ID) m_rbOutputFormat->GetSelection();
std::string buffer;
ExportToBuffer( buffer, format );
wxLogNull doNotLog; // disable logging of failed clipboard actions
// Write buffer to the clipboard
if( wxTheClipboard->Open() )
{
// This data objects are held by the clipboard,
// so do not delete them in the app.
wxTheClipboard->SetData( new wxTextDataObject( buffer.c_str() ) );
wxTheClipboard->Flush(); // Allow data to be available after closing KiCad
wxTheClipboard->Close();
}
else
{
wxMessageBox( _( "Unable to export to the Clipboard") );
}
}
void BM2CMP_FRAME::exportBitmap( OUTPUT_FMT_ID aFormat )
{
switch( aFormat )
{
case EESCHEMA_FMT: exportEeschemaFormat(); break;
case PCBNEW_KICAD_MOD: exportPcbnewFormat(); break;
case POSTSCRIPT_FMT: exportPostScriptFormat(); break;
case KICAD_WKS_LOGO: exportLogo(); break;
}
}
void BM2CMP_FRAME::exportLogo()
{
wxFileName fn( m_ConvertedFileName );
wxString path = fn.GetPath();
if( path.IsEmpty() || !wxDirExists(path) )
path = ::wxGetCwd();
wxFileDialog fileDlg( this, _( "Create Logo File" ), path, wxEmptyString,
DrawingSheetFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
int diag = fileDlg.ShowModal();
if( diag != wxID_OK )
return;
fn = fileDlg.GetPath();
fn.SetExt( DrawingSheetFileExtension );
m_ConvertedFileName = fn.GetFullPath();
FILE* outfile;
outfile = wxFopen( m_ConvertedFileName, wxT( "w" ) );
if( outfile == nullptr )
{
wxString msg;
msg.Printf( _( "File '%s' could not be created." ), m_ConvertedFileName );
wxMessageBox( msg );
return;
}
std::string buffer;
ExportToBuffer( buffer, KICAD_WKS_LOGO );
fputs( buffer.c_str(), outfile );
fclose( outfile );
}
void BM2CMP_FRAME::exportPostScriptFormat()
{
wxFileName fn( m_ConvertedFileName );
wxString path = fn.GetPath();
if( path.IsEmpty() || !wxDirExists( path ) )
path = ::wxGetCwd();
wxFileDialog fileDlg( this, _( "Create PostScript File" ), path, wxEmptyString,
PSFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
if( fileDlg.ShowModal() != wxID_OK )
return;
fn = fileDlg.GetPath();
fn.SetExt( wxT( "ps" ) );
m_ConvertedFileName = fn.GetFullPath();
FILE* outfile;
outfile = wxFopen( m_ConvertedFileName, wxT( "w" ) );
if( outfile == nullptr )
{
wxString msg;
msg.Printf( _( "File '%s' could not be created." ), m_ConvertedFileName );
wxMessageBox( msg );
return;
}
std::string buffer;
ExportToBuffer( buffer, POSTSCRIPT_FMT );
fputs( buffer.c_str(), outfile );
fclose( outfile );
}
void BM2CMP_FRAME::exportEeschemaFormat()
{
wxFileName fn( m_ConvertedFileName );
wxString path = fn.GetPath();
if( path.IsEmpty() || !wxDirExists(path) )
path = ::wxGetCwd();
wxFileDialog fileDlg( this, _( "Create Symbol Library" ), path, wxEmptyString,
KiCadSymbolLibFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
if( fileDlg.ShowModal() != wxID_OK )
return;
fn = fileDlg.GetPath();
fn.SetExt( KiCadSymbolLibFileExtension );
m_ConvertedFileName = fn.GetFullPath();
FILE* outfile = wxFopen( m_ConvertedFileName, wxT( "w" ) );
if( outfile == nullptr )
{
wxString msg;
msg.Printf( _( "File '%s' could not be created." ), m_ConvertedFileName );
wxMessageBox( msg );
return;
}
std::string buffer;
ExportToBuffer( buffer, EESCHEMA_FMT );
fputs( buffer.c_str(), outfile );
fclose( outfile );
}
void BM2CMP_FRAME::exportPcbnewFormat()
{
wxFileName fn( m_ConvertedFileName );
wxString path = fn.GetPath();
if( path.IsEmpty() || !wxDirExists( path ) )
path = m_mruPath;
wxFileDialog fileDlg( this, _( "Create Footprint Library" ), path, wxEmptyString,
KiCadFootprintLibFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
if( fileDlg.ShowModal() != wxID_OK )
return;
fn = fileDlg.GetPath();
fn.SetExt( KiCadFootprintFileExtension );
m_ConvertedFileName = fn.GetFullPath();
FILE* outfile = wxFopen( m_ConvertedFileName, wxT( "w" ) );
if( outfile == nullptr )
{
wxString msg;
msg.Printf( _( "File '%s' could not be created." ), m_ConvertedFileName );
wxMessageBox( msg );
return;
}
std::string buffer;
ExportToBuffer( buffer, PCBNEW_KICAD_MOD );
fputs( buffer.c_str(), outfile );
fclose( outfile );
m_mruPath = fn.GetPath();
}
void BM2CMP_FRAME::ExportToBuffer( std::string& aOutput, OUTPUT_FMT_ID aFormat )
{
// Create a potrace bitmap
int h = m_NB_Image.GetHeight();
int w = m_NB_Image.GetWidth();
potrace_bitmap_t* potrace_bitmap = bm_new( w, h );
if( !potrace_bitmap )
{
wxString msg;
msg.Printf( _( "Error allocating memory for potrace bitmap" ) );
wxMessageBox( msg );
return;
}
/* fill the bitmap with data */
for( int y = 0; y < h; y++ )
{
for( int x = 0; x < w; x++ )
{
unsigned char pix = m_NB_Image.GetGreen( x, y );
BM_PUT( potrace_bitmap, x, y, pix ? 0 : 1 );
}
}
// choices of m_rbPCBLayer are expected to be in same order as
// BMP2CMP_MOD_LAYER. See bitmap2component.h
BMP2CMP_MOD_LAYER modLayer = MOD_LYR_FSILKS;
if( aFormat == PCBNEW_KICAD_MOD )
modLayer = (BMP2CMP_MOD_LAYER) m_rbPCBLayer->GetSelection();
BITMAPCONV_INFO converter( aOutput );
converter.ConvertBitmap( potrace_bitmap, aFormat, m_outputSizeX.GetOutputDPI(),
m_outputSizeY.GetOutputDPI(), modLayer );
if( !converter.GetErrorMessages().empty() )
wxMessageBox( converter.GetErrorMessages().c_str(), _( "Errors" ) );
}
void BM2CMP_FRAME::OnFormatChange( wxCommandEvent& event )
{
if( m_rbOutputFormat->GetSelection() == PCBNEW_KICAD_MOD )
m_rbPCBLayer->Enable( true );
else
m_rbPCBLayer->Enable( false );
}
+178
View File
@@ -0,0 +1,178 @@
/*
* This program source code file is part of KICAD, a free EDA CAD application.
*
* Copyright (C) 2019-2022 Kicad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef BITMOP2CMP_GUI_H_
#define BITMOP2CMP_GUI_H_
#include "bitmap2component.h"
#include "bitmap2cmp_gui_base.h"
#include <eda_units.h>
#include <potracelib.h>
class IMAGE_SIZE
{
public:
IMAGE_SIZE();
// Set the unit used for m_outputSize, and convert the old m_outputSize value
// to the value in new unit
void SetUnit( EDA_UNITS aUnit );
// Accessors:
void SetOriginalDPI( int aDPI )
{
m_originalDPI = aDPI;
}
void SetOriginalSizePixels( int aPixels )
{
m_originalSizePixels = aPixels;
}
double GetOutputSize()
{
return m_outputSize;
}
void SetOutputSize( double aSize, EDA_UNITS aUnit )
{
m_unit = aUnit;
m_outputSize = aSize;
}
int GetOriginalSizePixels()
{
return m_originalSizePixels;
}
// Set the m_outputSize value from the m_originalSizePixels and the selected unit
void SetOutputSizeFromInitialImageSize();
/** @return the pixels per inch value to build the output image.
* It is used by potrace to build the polygonal image
*/
int GetOutputDPI();
private:
EDA_UNITS m_unit; // The units for m_outputSize (mm, inch, dpi)
double m_outputSize; // The size in m_unit of the output image, depending on
// the user settings. Set to the initial image size
int m_originalDPI; // The image DPI if specified in file, or 0 if unknown
int m_originalSizePixels; // The original image size read from file, in pixels
};
class BM2CMP_FRAME : public BM2CMP_FRAME_BASE
{
public:
BM2CMP_FRAME( KIWAY* aKiway, wxWindow* aParent );
~BM2CMP_FRAME();
// overload KIWAY_PLAYER virtual
bool OpenProjectFiles( const std::vector<wxString>& aFilenames, int aCtl = 0 ) override;
void OnExit( wxCommandEvent& event );
void OnLoadFile( wxCommandEvent& event ) override;
DECLARE_EVENT_TABLE()
private:
// Event handlers
void OnPaintInit( wxPaintEvent& event ) override;
void OnPaintGreyscale( wxPaintEvent& event ) override;
void OnPaintBW( wxPaintEvent& event ) override;
void OnExportToFile( wxCommandEvent& event ) override;
void OnExportToClipboard( wxCommandEvent& event ) override;
///< @return the EDA_UNITS from the m_PixelUnit choice
EDA_UNITS getUnitFromSelection();
// return a string giving the output size, according to the selected unit
wxString FormatOutputSize( double aSize );
/**
* Generate a schematic library which contains one component:
* the logo
*/
void exportEeschemaFormat();
/**
* Generate a footprint in S expr format
*/
void exportPcbnewFormat();
/**
* Generate a postscript file
*/
void exportPostScriptFormat();
/**
* Generate a file suitable to be copied into a drawing sheet (.kicad_wks) file
*/
void exportLogo();
void Binarize( double aThreshold ); // aThreshold = 0.0 (black level) to 1.0 (white level)
void OnNegativeClicked( wxCommandEvent& event ) override;
void OnThresholdChange( wxScrollEvent& event ) override;
void OnSizeChangeX( wxCommandEvent& event ) override;
void OnSizeChangeY( wxCommandEvent& event ) override;
void OnSizeUnitChange( wxCommandEvent& event ) override;
void ToggleAspectRatioLock( wxCommandEvent& event ) override;
void NegateGreyscaleImage();
/**
* generate a export data of the current bitmap.
* @param aOutput is a string buffer to fill with data
* @param aFormat is the format to generate
*/
void ExportToBuffer( std::string& aOutput, OUTPUT_FMT_ID aFormat );
void updateImageInfo();
void OnFormatChange( wxCommandEvent& event ) override;
void exportBitmap( OUTPUT_FMT_ID aFormat );
void LoadSettings( APP_SETTINGS_BASE* aCfg ) override;
void SaveSettings( APP_SETTINGS_BASE* aCfg ) override;
wxWindow* GetToolCanvas() const override;
protected:
void doReCreateMenuBar() override;
private:
wxImage m_Pict_Image;
wxBitmap m_Pict_Bitmap;
wxImage m_Greyscale_Image;
wxBitmap m_Greyscale_Bitmap;
wxImage m_NB_Image;
wxBitmap m_BN_Bitmap;
IMAGE_SIZE m_outputSizeX;
IMAGE_SIZE m_outputSizeY;
bool m_Negative;
wxString m_BitmapFileName;
wxString m_ConvertedFileName;
double m_AspectRatio;
};
#endif// BITMOP2CMP_GUI_H_
+224
View File
@@ -0,0 +1,224 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "bitmap2cmp_gui_base.h"
///////////////////////////////////////////////////////////////////////////
BM2CMP_FRAME_BASE::BM2CMP_FRAME_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : KIWAY_PLAYER( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* bMainSizer;
bMainSizer = new wxBoxSizer( wxHORIZONTAL );
m_Notebook = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
m_Notebook->SetMinSize( wxSize( 500,-1 ) );
m_InitialPicturePanel = new wxScrolledWindow( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL );
m_InitialPicturePanel->SetScrollRate( 5, 5 );
m_Notebook->AddPage( m_InitialPicturePanel, _("Original Picture"), false );
m_GreyscalePicturePanel = new wxScrolledWindow( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL );
m_GreyscalePicturePanel->SetScrollRate( 5, 5 );
m_Notebook->AddPage( m_GreyscalePicturePanel, _("Greyscale Picture"), false );
m_BNPicturePanel = new wxScrolledWindow( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL );
m_BNPicturePanel->SetScrollRate( 5, 5 );
m_Notebook->AddPage( m_BNPicturePanel, _("Black && White Picture"), true );
bMainSizer->Add( m_Notebook, 1, wxEXPAND|wxBOTTOM|wxLEFT, 5 );
wxBoxSizer* brightSizer;
brightSizer = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* sbSizerInfo;
sbSizerInfo = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Image Information") ), wxVERTICAL );
wxFlexGridSizer* fgSizerInfo;
fgSizerInfo = new wxFlexGridSizer( 0, 4, 0, 0 );
fgSizerInfo->AddGrowableCol( 1 );
fgSizerInfo->AddGrowableCol( 2 );
fgSizerInfo->SetFlexibleDirection( wxBOTH );
fgSizerInfo->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_staticTextISize = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("Image size:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextISize->Wrap( -1 );
fgSizerInfo->Add( m_staticTextISize, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_SizeXValue = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("0000"), wxDefaultPosition, wxDefaultSize, 0 );
m_SizeXValue->Wrap( -1 );
fgSizerInfo->Add( m_SizeXValue, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_SizeYValue = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("0000"), wxDefaultPosition, wxDefaultSize, 0 );
m_SizeYValue->Wrap( -1 );
fgSizerInfo->Add( m_SizeYValue, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 );
m_SizePixUnits = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("pixels"), wxDefaultPosition, wxDefaultSize, 0 );
m_SizePixUnits->Wrap( -1 );
fgSizerInfo->Add( m_SizePixUnits, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 );
m_staticTextDPI = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("Image PPI:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextDPI->Wrap( -1 );
fgSizerInfo->Add( m_staticTextDPI, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_InputXValueDPI = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("0000"), wxDefaultPosition, wxDefaultSize, 0 );
m_InputXValueDPI->Wrap( -1 );
fgSizerInfo->Add( m_InputXValueDPI, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_InputYValueDPI = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("0000"), wxDefaultPosition, wxDefaultSize, 0 );
m_InputYValueDPI->Wrap( -1 );
fgSizerInfo->Add( m_InputYValueDPI, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 );
m_DPIUnit = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("PPI"), wxDefaultPosition, wxDefaultSize, 0 );
m_DPIUnit->Wrap( -1 );
fgSizerInfo->Add( m_DPIUnit, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 );
m_staticTextBPP = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("BPP:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextBPP->Wrap( -1 );
fgSizerInfo->Add( m_staticTextBPP, 0, wxBOTTOM|wxLEFT|wxRIGHT, 5 );
m_BPPValue = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("0000"), wxDefaultPosition, wxDefaultSize, 0 );
m_BPPValue->Wrap( -1 );
fgSizerInfo->Add( m_BPPValue, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_BPPunits = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("bits"), wxDefaultPosition, wxDefaultSize, 0 );
m_BPPunits->Wrap( -1 );
fgSizerInfo->Add( m_BPPunits, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 );
fgSizerInfo->Add( 0, 0, 0, 0, 5 );
sbSizerInfo->Add( fgSizerInfo, 0, wxEXPAND, 5 );
brightSizer->Add( sbSizerInfo, 0, wxEXPAND|wxALL, 5 );
m_buttonLoad = new wxButton( this, wxID_ANY, _("Load Source Image"), wxDefaultPosition, wxDefaultSize, 0 );
brightSizer->Add( m_buttonLoad, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
brightSizer->Add( 0, 10, 1, wxEXPAND, 5 );
wxStaticBoxSizer* sbSizerImgPrms;
sbSizerImgPrms = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Output Size") ), wxVERTICAL );
m_aspectRatioCheckbox = new wxCheckBox( sbSizerImgPrms->GetStaticBox(), wxID_ANY, _("Lock height / width ratio"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizerImgPrms->Add( m_aspectRatioCheckbox, 0, wxBOTTOM, 5 );
wxBoxSizer* bSizerRes;
bSizerRes = new wxBoxSizer( wxHORIZONTAL );
m_staticTextOSize = new wxStaticText( sbSizerImgPrms->GetStaticBox(), wxID_ANY, _("Size:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextOSize->Wrap( -1 );
bSizerRes->Add( m_staticTextOSize, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT|wxTOP, 5 );
m_UnitSizeX = new wxTextCtrl( sbSizerImgPrms->GetStaticBox(), wxID_ANY, _("300"), wxDefaultPosition, wxDefaultSize, 0 );
m_UnitSizeX->SetMinSize( wxSize( 60,-1 ) );
bSizerRes->Add( m_UnitSizeX, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 );
m_UnitSizeY = new wxTextCtrl( sbSizerImgPrms->GetStaticBox(), wxID_ANY, _("300"), wxDefaultPosition, wxDefaultSize, 0 );
m_UnitSizeY->SetMinSize( wxSize( 60,-1 ) );
bSizerRes->Add( m_UnitSizeY, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 );
wxArrayString m_PixelUnitChoices;
m_PixelUnit = new wxChoice( sbSizerImgPrms->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_PixelUnitChoices, 0 );
m_PixelUnit->SetSelection( 0 );
m_PixelUnit->SetMinSize( wxSize( 80,-1 ) );
bSizerRes->Add( m_PixelUnit, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxTOP, 5 );
sbSizerImgPrms->Add( bSizerRes, 0, wxEXPAND, 5 );
brightSizer->Add( sbSizerImgPrms, 0, wxALL|wxEXPAND, 5 );
wxStaticBoxSizer* sbSizer2;
sbSizer2 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Options") ), wxVERTICAL );
m_ThresholdText = new wxStaticText( sbSizer2->GetStaticBox(), wxID_ANY, _("Black / white threshold:"), wxDefaultPosition, wxDefaultSize, 0 );
m_ThresholdText->Wrap( -1 );
sbSizer2->Add( m_ThresholdText, 0, wxLEFT, 5 );
m_sliderThreshold = new wxSlider( sbSizer2->GetStaticBox(), wxID_ANY, 50, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS );
m_sliderThreshold->SetToolTip( _("Adjust the level to convert the greyscale picture to a black and white picture.") );
sbSizer2->Add( m_sliderThreshold, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
m_checkNegative = new wxCheckBox( sbSizer2->GetStaticBox(), wxID_ANY, _("Negative"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizer2->Add( m_checkNegative, 0, wxTOP|wxBOTTOM, 5 );
brightSizer->Add( sbSizer2, 0, wxALL|wxEXPAND, 5 );
wxString m_rbPCBLayerChoices[] = { _("Front silk screen"), _("Front solder mask"), _("User layer Eco1"), _("User layer Eco2") };
int m_rbPCBLayerNChoices = sizeof( m_rbPCBLayerChoices ) / sizeof( wxString );
m_rbPCBLayer = new wxRadioBox( this, wxID_ANY, _("Board Layer for Outline"), wxDefaultPosition, wxDefaultSize, m_rbPCBLayerNChoices, m_rbPCBLayerChoices, 1, wxRA_SPECIFY_COLS );
m_rbPCBLayer->SetSelection( 1 );
m_rbPCBLayer->SetToolTip( _("Choose the board layer to place the outline.\nThe reference designator and value are always placed on the silk screen layer (but will be marked invisible).") );
brightSizer->Add( m_rbPCBLayer, 0, wxALL|wxEXPAND, 5 );
wxString m_rbOutputFormatChoices[] = { _("Symbol (.kicad_sym file)"), _("Footprint (.kicad_mod file)"), _("Postscript (.ps file)"), _("Drawing Sheet (.kicad_wks file)") };
int m_rbOutputFormatNChoices = sizeof( m_rbOutputFormatChoices ) / sizeof( wxString );
m_rbOutputFormat = new wxRadioBox( this, wxID_ANY, _("Output Format"), wxDefaultPosition, wxDefaultSize, m_rbOutputFormatNChoices, m_rbOutputFormatChoices, 1, wxRA_SPECIFY_COLS );
m_rbOutputFormat->SetSelection( 0 );
brightSizer->Add( m_rbOutputFormat, 0, wxEXPAND|wxALL, 5 );
m_buttonExportFile = new wxButton( this, wxID_ANY, _("Export to File"), wxDefaultPosition, wxDefaultSize, 0 );
brightSizer->Add( m_buttonExportFile, 0, wxEXPAND|wxALL, 5 );
m_buttonExportClipboard = new wxButton( this, wxID_ANY, _("Export to Clipboard"), wxDefaultPosition, wxDefaultSize, 0 );
brightSizer->Add( m_buttonExportClipboard, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bMainSizer->Add( brightSizer, 0, wxEXPAND|wxTOP|wxBOTTOM|wxRIGHT, 5 );
this->SetSizer( bMainSizer );
this->Layout();
bMainSizer->Fit( this );
m_statusBar = this->CreateStatusBar( 1, wxSTB_SIZEGRIP, wxID_ANY );
// Connect Events
m_InitialPicturePanel->Connect( wxEVT_PAINT, wxPaintEventHandler( BM2CMP_FRAME_BASE::OnPaintInit ), NULL, this );
m_GreyscalePicturePanel->Connect( wxEVT_PAINT, wxPaintEventHandler( BM2CMP_FRAME_BASE::OnPaintGreyscale ), NULL, this );
m_BNPicturePanel->Connect( wxEVT_PAINT, wxPaintEventHandler( BM2CMP_FRAME_BASE::OnPaintBW ), NULL, this );
m_buttonLoad->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnLoadFile ), NULL, this );
m_aspectRatioCheckbox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::ToggleAspectRatioLock ), NULL, this );
m_UnitSizeX->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnSizeChangeX ), NULL, this );
m_UnitSizeY->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnSizeChangeY ), NULL, this );
m_PixelUnit->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnSizeUnitChange ), NULL, this );
m_sliderThreshold->Connect( wxEVT_SCROLL_CHANGED, wxScrollEventHandler( BM2CMP_FRAME_BASE::OnThresholdChange ), NULL, this );
m_sliderThreshold->Connect( wxEVT_SCROLL_THUMBTRACK, wxScrollEventHandler( BM2CMP_FRAME_BASE::OnThresholdChange ), NULL, this );
m_checkNegative->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnNegativeClicked ), NULL, this );
m_rbOutputFormat->Connect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnFormatChange ), NULL, this );
m_buttonExportFile->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnExportToFile ), NULL, this );
m_buttonExportClipboard->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnExportToClipboard ), NULL, this );
}
BM2CMP_FRAME_BASE::~BM2CMP_FRAME_BASE()
{
// Disconnect Events
m_InitialPicturePanel->Disconnect( wxEVT_PAINT, wxPaintEventHandler( BM2CMP_FRAME_BASE::OnPaintInit ), NULL, this );
m_GreyscalePicturePanel->Disconnect( wxEVT_PAINT, wxPaintEventHandler( BM2CMP_FRAME_BASE::OnPaintGreyscale ), NULL, this );
m_BNPicturePanel->Disconnect( wxEVT_PAINT, wxPaintEventHandler( BM2CMP_FRAME_BASE::OnPaintBW ), NULL, this );
m_buttonLoad->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnLoadFile ), NULL, this );
m_aspectRatioCheckbox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::ToggleAspectRatioLock ), NULL, this );
m_UnitSizeX->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnSizeChangeX ), NULL, this );
m_UnitSizeY->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnSizeChangeY ), NULL, this );
m_PixelUnit->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnSizeUnitChange ), NULL, this );
m_sliderThreshold->Disconnect( wxEVT_SCROLL_CHANGED, wxScrollEventHandler( BM2CMP_FRAME_BASE::OnThresholdChange ), NULL, this );
m_sliderThreshold->Disconnect( wxEVT_SCROLL_THUMBTRACK, wxScrollEventHandler( BM2CMP_FRAME_BASE::OnThresholdChange ), NULL, this );
m_checkNegative->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnNegativeClicked ), NULL, this );
m_rbOutputFormat->Disconnect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnFormatChange ), NULL, this );
m_buttonExportFile->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnExportToFile ), NULL, this );
m_buttonExportClipboard->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnExportToClipboard ), NULL, this );
}
File diff suppressed because it is too large Load Diff
+101
View File
@@ -0,0 +1,101 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#pragma once
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include "kiway_player.h"
#include <wx/scrolwin.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/string.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/notebook.h>
#include <wx/stattext.h>
#include <wx/sizer.h>
#include <wx/statbox.h>
#include <wx/button.h>
#include <wx/checkbox.h>
#include <wx/textctrl.h>
#include <wx/valtext.h>
#include <wx/choice.h>
#include <wx/slider.h>
#include <wx/radiobox.h>
#include <wx/statusbr.h>
#include <wx/frame.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class BM2CMP_FRAME_BASE
///////////////////////////////////////////////////////////////////////////////
class BM2CMP_FRAME_BASE : public KIWAY_PLAYER
{
private:
protected:
wxNotebook* m_Notebook;
wxScrolledWindow* m_InitialPicturePanel;
wxScrolledWindow* m_GreyscalePicturePanel;
wxScrolledWindow* m_BNPicturePanel;
wxStaticText* m_staticTextISize;
wxStaticText* m_SizeXValue;
wxStaticText* m_SizeYValue;
wxStaticText* m_SizePixUnits;
wxStaticText* m_staticTextDPI;
wxStaticText* m_InputXValueDPI;
wxStaticText* m_InputYValueDPI;
wxStaticText* m_DPIUnit;
wxStaticText* m_staticTextBPP;
wxStaticText* m_BPPValue;
wxStaticText* m_BPPunits;
wxButton* m_buttonLoad;
wxCheckBox* m_aspectRatioCheckbox;
wxStaticText* m_staticTextOSize;
wxTextCtrl* m_UnitSizeX;
wxTextCtrl* m_UnitSizeY;
wxChoice* m_PixelUnit;
wxStaticText* m_ThresholdText;
wxSlider* m_sliderThreshold;
wxCheckBox* m_checkNegative;
wxRadioBox* m_rbPCBLayer;
wxRadioBox* m_rbOutputFormat;
wxButton* m_buttonExportFile;
wxButton* m_buttonExportClipboard;
wxStatusBar* m_statusBar;
// Virtual event handlers, override them in your derived class
virtual void OnPaintInit( wxPaintEvent& event ) { event.Skip(); }
virtual void OnPaintGreyscale( wxPaintEvent& event ) { event.Skip(); }
virtual void OnPaintBW( wxPaintEvent& event ) { event.Skip(); }
virtual void OnLoadFile( wxCommandEvent& event ) { event.Skip(); }
virtual void ToggleAspectRatioLock( wxCommandEvent& event ) { event.Skip(); }
virtual void OnSizeChangeX( wxCommandEvent& event ) { event.Skip(); }
virtual void OnSizeChangeY( wxCommandEvent& event ) { event.Skip(); }
virtual void OnSizeUnitChange( wxCommandEvent& event ) { event.Skip(); }
virtual void OnThresholdChange( wxScrollEvent& event ) { event.Skip(); }
virtual void OnNegativeClicked( wxCommandEvent& event ) { event.Skip(); }
virtual void OnFormatChange( wxCommandEvent& event ) { event.Skip(); }
virtual void OnExportToFile( wxCommandEvent& event ) { event.Skip(); }
virtual void OnExportToClipboard( wxCommandEvent& event ) { event.Skip(); }
public:
BM2CMP_FRAME_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Image Converter"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxCLOSE_BOX|wxDEFAULT_FRAME_STYLE|wxRESIZE_BORDER|wxTAB_TRAVERSAL );
~BM2CMP_FRAME_BASE();
};
+4 -4
View File
@@ -22,7 +22,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <bitmap2cmp_frame.h>
#include <bitmap2cmp_gui.h>
#include <bitmap2cmp_settings.h>
#include <kiface_base.h>
#include <kiway.h>
@@ -34,14 +34,14 @@ namespace BMP2CMP {
static struct IFACE : public KIFACE_BASE
{
bool OnKifaceStart( PGM_BASE* aProgram, int aCtlBits, KIWAY* aKiway ) override;
bool OnKifaceStart( PGM_BASE* aProgram, int aCtlBits ) override;
wxWindow* CreateKiWindow( wxWindow* aParent, int aClassId, KIWAY* aKiway,
int aCtlBits = 0 ) override
{
InitSettings( new BITMAP2CMP_SETTINGS );
Pgm().GetSettingsManager().RegisterSettings( KifaceSettings() );
return new BITMAP2CMP_FRAME( aKiway, aParent );
return new BM2CMP_FRAME( aKiway, aParent );
}
/**
@@ -103,7 +103,7 @@ PGM_BASE* PgmOrNull()
#endif
bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits, KIWAY* aKiway )
bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits )
{
return start_common( aCtlBits );
}
-575
View File
@@ -1,575 +0,0 @@
/*
* This program source code file is part of KICAD, a free EDA CAD application.
*
* Copyright (C) 1992-2010 jean-pierre.charras
* Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <bitmap2cmp_frame.h>
#include <bitmap2component.h>
#include <bitmap2cmp_panel.h>
#include <bitmap2cmp_settings.h>
#include <bitmap_io.h>
#include <bitmaps.h>
#include <common.h>
#include <kiface_base.h>
#include <math/util.h> // for KiROUND
#include <pgm_base.h>
#include <potracelib.h>
#include <wx/clipbrd.h>
#include <wx/rawbmp.h>
#include <wx/msgdlg.h>
#include <wx/dcclient.h>
#include <wx/log.h>
#define DEFAULT_DPI 300 // the image DPI used in formats that do not define a DPI
BITMAP2CMP_PANEL::BITMAP2CMP_PANEL( BITMAP2CMP_FRAME* aParent ) :
BITMAP2CMP_PANEL_BASE( aParent ),
m_parentFrame( aParent ), m_negative( false ),
m_aspectRatio( 1.0 )
{
for( wxString unit : { _( "mm" ), _( "Inch" ), _( "DPI" ) } )
m_PixelUnit->Append( unit );
m_outputSizeX.SetUnit( getUnitFromSelection() );
m_outputSizeY.SetUnit( getUnitFromSelection() );
m_outputSizeX.SetOutputSize( 0, getUnitFromSelection() );
m_outputSizeY.SetOutputSize( 0, getUnitFromSelection() );
m_UnitSizeX->ChangeValue( FormatOutputSize( m_outputSizeX.GetOutputSize() ) );
m_UnitSizeY->ChangeValue( FormatOutputSize( m_outputSizeY.GetOutputSize() ) );
m_buttonExportFile->Enable( false );
m_buttonExportClipboard->Enable( false );
}
BITMAP2CMP_PANEL::~BITMAP2CMP_PANEL()
{
}
wxWindow* BITMAP2CMP_PANEL::GetCurrentPage()
{
return m_Notebook->GetCurrentPage();
}
void BITMAP2CMP_PANEL::LoadSettings( BITMAP2CMP_SETTINGS* cfg )
{
int u_select = cfg->m_Units;
if( u_select < 0 || u_select > 2 ) // Validity control
u_select = 0;
m_PixelUnit->SetSelection( u_select );
m_sliderThreshold->SetValue( cfg->m_Threshold );
m_negative = cfg->m_Negative;
m_checkNegative->SetValue( cfg->m_Negative );
m_aspectRatio = 1.0;
m_aspectRatioCheckbox->SetValue( true );
int format = cfg->m_LastFormat;
if( format < 0 || format > FINAL_FMT )
format = PCBNEW_KICAD_MOD;
m_rbOutputFormat->SetSelection( format );
bool enable = format == PCBNEW_KICAD_MOD;
m_chPCBLayer->Enable( enable );
int last_layer = cfg->m_LastModLayer;
if( last_layer < 0 || last_layer > static_cast<int>( MOD_LYR_FINAL ) ) // Out of range
last_layer = MOD_LYR_FSILKS;
m_chPCBLayer->SetSelection( last_layer );
}
void BITMAP2CMP_PANEL::SaveSettings( BITMAP2CMP_SETTINGS* cfg )
{
cfg->m_Threshold = m_sliderThreshold->GetValue();
cfg->m_Negative = m_checkNegative->IsChecked();
cfg->m_LastFormat = m_rbOutputFormat->GetSelection();
cfg->m_LastModLayer = m_chPCBLayer->GetSelection();
cfg->m_Units = m_PixelUnit->GetSelection();
}
void BITMAP2CMP_PANEL::OnPaintInit( wxPaintEvent& event )
{
#ifdef __WXMAC__
// Otherwise fails due: using wxPaintDC without being in a native paint event
wxClientDC pict_dc( m_InitialPicturePanel );
#else
wxPaintDC pict_dc( m_InitialPicturePanel );
#endif
m_InitialPicturePanel->PrepareDC( pict_dc );
// OSX crashes with empty bitmaps (on initial refreshes)
if( m_Pict_Bitmap.IsOk() )
pict_dc.DrawBitmap( m_Pict_Bitmap, 0, 0, !!m_Pict_Bitmap.GetMask() );
event.Skip();
}
void BITMAP2CMP_PANEL::OnPaintGreyscale( wxPaintEvent& event )
{
#ifdef __WXMAC__
// Otherwise fails due: using wxPaintDC without being in a native paint event
wxClientDC greyscale_dc( m_GreyscalePicturePanel );
#else
wxPaintDC greyscale_dc( m_GreyscalePicturePanel );
#endif
m_GreyscalePicturePanel->PrepareDC( greyscale_dc );
// OSX crashes with empty bitmaps (on initial refreshes)
if( m_Greyscale_Bitmap.IsOk() )
greyscale_dc.DrawBitmap( m_Greyscale_Bitmap, 0, 0, !!m_Greyscale_Bitmap.GetMask() );
event.Skip();
}
void BITMAP2CMP_PANEL::OnPaintBW( wxPaintEvent& event )
{
#ifdef __WXMAC__
// Otherwise fails due: using wxPaintDC without being in a native paint event
wxClientDC nb_dc( m_BNPicturePanel );
#else
wxPaintDC nb_dc( m_BNPicturePanel );
#endif
m_BNPicturePanel->PrepareDC( nb_dc );
if( m_BN_Bitmap.IsOk() )
nb_dc.DrawBitmap( m_BN_Bitmap, 0, 0, !!m_BN_Bitmap.GetMask() );
event.Skip();
}
void BITMAP2CMP_PANEL::OnLoadFile( wxCommandEvent& event )
{
m_parentFrame->OnLoadFile();
}
bool BITMAP2CMP_PANEL::OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl )
{
m_Pict_Image.Destroy();
if( !m_Pict_Image.LoadFile( aFileSet[0] ) )
{
// LoadFile has its own UI, no need for further failure notification here
return false;
}
m_Pict_Bitmap = wxBitmap( m_Pict_Image );
// Determine image resolution in DPI (does not existing in all formats).
// the resolution can be given in bit per inches or bit per cm in file
int imageDPIx = m_Pict_Image.GetOptionInt( wxIMAGE_OPTION_RESOLUTIONX );
int imageDPIy = m_Pict_Image.GetOptionInt( wxIMAGE_OPTION_RESOLUTIONY );
if( imageDPIx > 1 && imageDPIy > 1 )
{
if( m_Pict_Image.GetOptionInt( wxIMAGE_OPTION_RESOLUTIONUNIT ) == wxIMAGE_RESOLUTION_CM )
{
imageDPIx = KiROUND( imageDPIx * 2.54 );
imageDPIy = KiROUND( imageDPIy * 2.54 );
}
}
else // fallback to a default value (DEFAULT_DPI)
{
imageDPIx = imageDPIy = DEFAULT_DPI;
}
m_InputXValueDPI->SetLabel( wxString::Format( wxT( "%d" ), imageDPIx ) );
m_InputYValueDPI->SetLabel( wxString::Format( wxT( "%d" ), imageDPIy ) );
int h = m_Pict_Bitmap.GetHeight();
int w = m_Pict_Bitmap.GetWidth();
m_aspectRatio = (double) w / h;
m_outputSizeX.SetOriginalDPI( imageDPIx );
m_outputSizeX.SetOriginalSizePixels( w );
m_outputSizeY.SetOriginalDPI( imageDPIy );
m_outputSizeY.SetOriginalSizePixels( h );
// Update display to keep aspect ratio
wxCommandEvent dummy;
OnSizeChangeX( dummy );
updateImageInfo();
m_InitialPicturePanel->SetVirtualSize( w, h );
m_GreyscalePicturePanel->SetVirtualSize( w, h );
m_BNPicturePanel->SetVirtualSize( w, h );
m_Greyscale_Image.Destroy();
m_Greyscale_Image = m_Pict_Image.ConvertToGreyscale( );
if( m_Pict_Bitmap.GetMask() )
{
for( int x = 0; x < m_Pict_Bitmap.GetWidth(); x++ )
{
for( int y = 0; y < m_Pict_Bitmap.GetHeight(); y++ )
{
if( m_Pict_Image.GetRed( x, y ) == m_Pict_Image.GetMaskRed() &&
m_Pict_Image.GetGreen( x, y ) == m_Pict_Image.GetMaskGreen() &&
m_Pict_Image.GetBlue( x, y ) == m_Pict_Image.GetMaskBlue() )
{
m_Greyscale_Image.SetRGB( x, y, 255, 255, 255 );
}
}
}
}
if( m_negative )
NegateGreyscaleImage( );
m_Greyscale_Bitmap = wxBitmap( m_Greyscale_Image );
m_NB_Image = m_Greyscale_Image;
Binarize( (double) m_sliderThreshold->GetValue() / m_sliderThreshold->GetMax() );
m_buttonExportFile->Enable( true );
m_buttonExportClipboard->Enable( true );
m_outputSizeX.SetOutputSizeFromInitialImageSize();
m_UnitSizeX->ChangeValue( FormatOutputSize( m_outputSizeX.GetOutputSize() ) );
m_outputSizeY.SetOutputSizeFromInitialImageSize();
m_UnitSizeY->ChangeValue( FormatOutputSize( m_outputSizeY.GetOutputSize() ) );
return true;
}
// return a string giving the output size, according to the selected unit
wxString BITMAP2CMP_PANEL::FormatOutputSize( double aSize )
{
wxString text;
if( getUnitFromSelection() == EDA_UNITS::MILLIMETRES )
text.Printf( wxS( "%.1f" ), aSize );
else if( getUnitFromSelection() == EDA_UNITS::INCHES )
text.Printf( wxS( "%.2f" ), aSize );
else
text.Printf( wxT( "%d" ), KiROUND( aSize ) );
return text;
}
void BITMAP2CMP_PANEL::updateImageInfo()
{
// Note: the image resolution text controls are not modified here, to avoid a race between
// text change when entered by user and a text change if it is modified here.
if( m_Pict_Bitmap.IsOk() )
{
int h = m_Pict_Bitmap.GetHeight();
int w = m_Pict_Bitmap.GetWidth();
int nb = m_Pict_Bitmap.GetDepth();
m_SizeXValue->SetLabel( wxString::Format( wxT( "%d" ), w ) );
m_SizeYValue->SetLabel( wxString::Format( wxT( "%d" ), h ) );
m_BPPValue->SetLabel( wxString::Format( wxT( "%d" ), nb ) );
}
}
EDA_UNITS BITMAP2CMP_PANEL::getUnitFromSelection()
{
// return the EDA_UNITS from the m_PixelUnit choice
switch( m_PixelUnit->GetSelection() )
{
case 1: return EDA_UNITS::INCHES;
case 2: return EDA_UNITS::UNSCALED;
case 0:
default: return EDA_UNITS::MILLIMETRES;
}
}
void BITMAP2CMP_PANEL::OnSizeChangeX( wxCommandEvent& event )
{
double new_size;
if( m_UnitSizeX->GetValue().ToDouble( &new_size ) )
{
if( m_aspectRatioCheckbox->GetValue() )
{
double calculatedY = new_size / m_aspectRatio;
if( getUnitFromSelection() == EDA_UNITS::UNSCALED )
{
// for units in DPI, keeping aspect ratio cannot use m_AspectRatioLocked.
// just re-scale the other dpi
double ratio = new_size / m_outputSizeX.GetOutputSize();
calculatedY = m_outputSizeY.GetOutputSize() * ratio;
}
m_outputSizeY.SetOutputSize( calculatedY, getUnitFromSelection() );
m_UnitSizeY->ChangeValue( FormatOutputSize( m_outputSizeY.GetOutputSize() ) );
}
m_outputSizeX.SetOutputSize( new_size, getUnitFromSelection() );
}
updateImageInfo();
}
void BITMAP2CMP_PANEL::OnSizeChangeY( wxCommandEvent& event )
{
double new_size;
if( m_UnitSizeY->GetValue().ToDouble( &new_size ) )
{
if( m_aspectRatioCheckbox->GetValue() )
{
double calculatedX = new_size * m_aspectRatio;
if( getUnitFromSelection() == EDA_UNITS::UNSCALED )
{
// for units in DPI, keeping aspect ratio cannot use m_AspectRatioLocked.
// just re-scale the other dpi
double ratio = new_size / m_outputSizeX.GetOutputSize();
calculatedX = m_outputSizeX.GetOutputSize() * ratio;
}
m_outputSizeX.SetOutputSize( calculatedX, getUnitFromSelection() );
m_UnitSizeX->ChangeValue( FormatOutputSize( m_outputSizeX.GetOutputSize() ) );
}
m_outputSizeY.SetOutputSize( new_size, getUnitFromSelection() );
}
updateImageInfo();
}
void BITMAP2CMP_PANEL::OnSizeUnitChange( wxCommandEvent& event )
{
m_outputSizeX.SetUnit( getUnitFromSelection() );
m_outputSizeY.SetUnit( getUnitFromSelection() );
updateImageInfo();
m_UnitSizeX->ChangeValue( FormatOutputSize( m_outputSizeX.GetOutputSize() ) );
m_UnitSizeY->ChangeValue( FormatOutputSize( m_outputSizeY.GetOutputSize() ) );
}
void BITMAP2CMP_PANEL::SetOutputSize( const IMAGE_SIZE& aSizeX, const IMAGE_SIZE& aSizeY )
{
m_outputSizeX = aSizeX;
m_outputSizeY = aSizeY;
updateImageInfo();
m_UnitSizeX->ChangeValue( FormatOutputSize( m_outputSizeX.GetOutputSize() ) );
m_UnitSizeY->ChangeValue( FormatOutputSize( m_outputSizeY.GetOutputSize() ) );
}
void BITMAP2CMP_PANEL::ToggleAspectRatioLock( wxCommandEvent& event )
{
if( m_aspectRatioCheckbox->GetValue() )
{
// Force display update when aspect ratio is locked
wxCommandEvent dummy;
OnSizeChangeX( dummy );
}
}
void BITMAP2CMP_PANEL::Binarize( double aThreshold )
{
int h = m_Greyscale_Image.GetHeight();
int w = m_Greyscale_Image.GetWidth();
unsigned char threshold = aThreshold * 255;
unsigned char alpha_thresh = 0.7 * threshold;
for( int y = 0; y < h; y++ )
{
for( int x = 0; x < w; x++ )
{
unsigned char pixout;
unsigned char pixin = m_Greyscale_Image.GetGreen( x, y );
unsigned char alpha = m_Greyscale_Image.HasAlpha() ? m_Greyscale_Image.GetAlpha( x, y )
: wxALPHA_OPAQUE;
if( pixin < threshold && alpha > alpha_thresh )
pixout = 0;
else
pixout = 255;
m_NB_Image.SetRGB( x, y, pixout, pixout, pixout );
}
}
m_BN_Bitmap = wxBitmap( m_NB_Image );
}
void BITMAP2CMP_PANEL::NegateGreyscaleImage( )
{
unsigned char pix;
int h = m_Greyscale_Image.GetHeight();
int w = m_Greyscale_Image.GetWidth();
for( int y = 0; y < h; y++ )
{
for( int x = 0; x < w; x++ )
{
pix = m_Greyscale_Image.GetGreen( x, y );
pix = ~pix;
m_Greyscale_Image.SetRGB( x, y, pix, pix, pix );
}
}
}
void BITMAP2CMP_PANEL::OnNegativeClicked( wxCommandEvent& )
{
if( m_checkNegative->GetValue() != m_negative )
{
NegateGreyscaleImage();
m_Greyscale_Bitmap = wxBitmap( m_Greyscale_Image );
Binarize( (double)m_sliderThreshold->GetValue()/m_sliderThreshold->GetMax() );
m_negative = m_checkNegative->GetValue();
Refresh();
}
}
void BITMAP2CMP_PANEL::OnThresholdChange( wxScrollEvent& event )
{
Binarize( (double)m_sliderThreshold->GetValue()/m_sliderThreshold->GetMax() );
Refresh();
}
void BITMAP2CMP_PANEL::OnExportToFile( wxCommandEvent& event )
{
// choices of m_rbOutputFormat are expected to be in same order as
// OUTPUT_FMT_ID. See bitmap2component.h
OUTPUT_FMT_ID format = (OUTPUT_FMT_ID) m_rbOutputFormat->GetSelection();
exportBitmap( format );
}
void BITMAP2CMP_PANEL::OnExportToClipboard( wxCommandEvent& event )
{
// choices of m_rbOutputFormat are expected to be in same order as
// OUTPUT_FMT_ID. See bitmap2component.h
OUTPUT_FMT_ID format = (OUTPUT_FMT_ID) m_rbOutputFormat->GetSelection();
std::string buffer;
ExportToBuffer( buffer, format );
wxLogNull doNotLog; // disable logging of failed clipboard actions
// Write buffer to the clipboard
if( wxTheClipboard->Open() )
{
// This data objects are held by the clipboard,
// so do not delete them in the app.
wxTheClipboard->SetData( new wxTextDataObject( buffer.c_str() ) );
wxTheClipboard->Flush(); // Allow data to be available after closing KiCad
wxTheClipboard->Close();
}
else
{
wxMessageBox( _( "Unable to export to the Clipboard") );
}
}
void BITMAP2CMP_PANEL::exportBitmap( OUTPUT_FMT_ID aFormat )
{
switch( aFormat )
{
case EESCHEMA_FMT: m_parentFrame->ExportEeschemaFormat(); break;
case PCBNEW_KICAD_MOD: m_parentFrame->ExportPcbnewFormat(); break;
case POSTSCRIPT_FMT: m_parentFrame->ExportPostScriptFormat(); break;
case KICAD_WKS_LOGO: m_parentFrame->ExportDrawingSheetFormat(); break;
}
}
void BITMAP2CMP_PANEL::ExportToBuffer( std::string& aOutput, OUTPUT_FMT_ID aFormat )
{
// Create a potrace bitmap
int h = m_NB_Image.GetHeight();
int w = m_NB_Image.GetWidth();
potrace_bitmap_t* potrace_bitmap = bm_new( w, h );
if( !potrace_bitmap )
{
wxString msg;
msg.Printf( _( "Error allocating memory for potrace bitmap" ) );
wxMessageBox( msg );
return;
}
/* fill the bitmap with data */
for( int y = 0; y < h; y++ )
{
for( int x = 0; x < w; x++ )
{
unsigned char pix = m_NB_Image.GetGreen( x, y );
BM_PUT( potrace_bitmap, x, y, pix ? 0 : 1 );
}
}
// choices of m_rbPCBLayer are expected to be in same order as
// BMP2CMP_MOD_LAYER. See bitmap2component.h
BMP2CMP_MOD_LAYER modLayer = MOD_LYR_FSILKS;
if( aFormat == PCBNEW_KICAD_MOD )
modLayer = (BMP2CMP_MOD_LAYER) m_chPCBLayer->GetSelection();
BITMAPCONV_INFO converter( aOutput );
converter.ConvertBitmap( potrace_bitmap, aFormat, m_outputSizeX.GetOutputDPI(),
m_outputSizeY.GetOutputDPI(), modLayer );
if( !converter.GetErrorMessages().empty() )
wxMessageBox( converter.GetErrorMessages().c_str(), _( "Errors" ) );
}
void BITMAP2CMP_PANEL::OnFormatChange( wxCommandEvent& event )
{
bool enable = m_rbOutputFormat->GetSelection() == PCBNEW_KICAD_MOD;
m_chPCBLayer->Enable( enable );
}

Some files were not shown because too many files have changed in this diff Show More