Compare commits

...

663 Commits

Author SHA1 Message Date
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
891 changed files with 232129 additions and 106395 deletions
+1 -1
View File
@@ -14,7 +14,7 @@ default:
##########################################################################
# 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
# https://gitlab.com/gitlab-org/gitlab/-/issues/12850
test_formatting:
stage: test
needs: []
+1 -1
View File
@@ -7,7 +7,7 @@ build_doxygen_docker:
- docker
before_script:
- docker info
- docker login -u gitlab-ci-token -p "$CI_BUILD_TOKEN" "$CI_REGISTRY"
- docker login -u gitlab-ci-token -p "$CI_JOB_TOKEN" "$CI_REGISTRY"
script:
- docker build -t "${CI_REGISTRY_IMAGE}/doxygen:$CI_COMMIT_BRANCH" -f ./doxygen/doxygen.Dockerfile .
- docker push "${CI_REGISTRY_IMAGE}/doxygen:$CI_COMMIT_BRANCH"
+20
View File
@@ -0,0 +1,20 @@
<!-- --------Before Creating a New Issue-----------
* Limit report to a single issue.
* Search the issue tracker to verify the issue has not already been reported.
* Complete all instructions between `template comment markers <>.
* Keep report contents limited to the necessary information required to fix the issue.
* When creating an issue against the stable version of KiCad, make sure the latest available stable version is installed as issues may have already been resolved in later stable versions. -->
# Description
<!-- What is the current behavior and what is the expected behavior? -->
<!-- If the issue is visual/graphical, please attach screenshots of the problem. -->
<!-- Add the issue details below this line and before the "Steps to reproduce" heading. -->
# Steps to reproduce
<!-- If there are multiple steps to reproduce it or it is a visual issue, then providing a screen recording as an attachment to this report is recommended. -->
<!-- If this issue is specific to a project, please attach the necessary files to this issue. -->
<!-- Add the steps to reproduce using the numbers below -->
<!-- Add new step numbers before the "KiCad Version" heading. -->
1.
# KiCad Version
+25
View File
@@ -0,0 +1,25 @@
##########################################################################
# 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: []
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
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 add 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}
+1 -1
View File
@@ -28,7 +28,7 @@
# 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. Note that there is a bug with how paths
# are processed in the junit report (https://gitlab.com/gitlab-org/gitlab/issues/23835)
# 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:
reports:
+16 -5
View File
@@ -2,7 +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) 1992-2022 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
@@ -36,6 +36,7 @@
#include <pgm_base.h>
#include <settings/settings_manager.h>
#include <wx/log.h>
#include <pcbnew_settings.h>
#include <advanced_config.h>
@@ -92,8 +93,7 @@ BOARD_ADAPTER::BOARD_ADAPTER() :
{
wxLogTrace( m_logTrace, wxT( "BOARD_ADAPTER::BOARD_ADAPTER" ) );
if( PgmOrNull() )
m_colors = Pgm().GetSettingsManager().GetColorSettings();
ReloadColorSettings();
m_boardPos = VECTOR2I();
m_boardSize = VECTOR2I();
@@ -208,6 +208,15 @@ BOARD_ADAPTER::~BOARD_ADAPTER()
}
void BOARD_ADAPTER::ReloadColorSettings() noexcept
{
wxASSERT( PgmOrNull() );
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
{
wxASSERT( aLayer < PCB_LAYER_ID_COUNT );
@@ -251,7 +260,8 @@ bool BOARD_ADAPTER::Is3dLayerEnabled( PCB_LAYER_ID aLayer ) const
case B_Cu:
case F_Cu:
return !m_board || m_board->IsLayerVisible( aLayer ) || m_Cfg->m_Render.realistic;
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
@@ -671,7 +681,8 @@ bool BOARD_ADAPTER::createBoardPolygon( wxString* aErrorMsg )
return false;
}
int chainingEpsilon = pcbIUScale.mmToIU( 0.02 ); // max dist from one endPt to next startPt
// max dist from one endPt to next startPt
int chainingEpsilon = m_board->GetOutlinesChainingEpsilon();
success = BuildFootprintPolygonOutlines( m_board, m_board_poly,
m_board->GetDesignSettings().m_MaxError,
+2 -3
View File
@@ -100,7 +100,7 @@ public:
void SetBoard( BOARD* aBoard ) noexcept { m_board = aBoard; }
const BOARD* GetBoard() const noexcept { return m_board; }
void SetColorSettings( COLOR_SETTINGS* aSettings ) noexcept { m_colors = aSettings; }
void ReloadColorSettings() noexcept;
/**
* Function to be called by the render when it need to reload the settings for the board.
@@ -342,8 +342,7 @@ private:
OBJECT_2D* createPadWithDrill( const PAD* aPad, int aInflateValue );
void addPads( const FOOTPRINT* aFootprint, CONTAINER_2D_BASE* aDstContainer,
PCB_LAYER_ID aLayerId, bool aSkipNPTHPadsWihNoCopper, bool aSkipPlatedPads,
bool aSkipNonPlatedPads );
PCB_LAYER_ID aLayerId, bool aSkipPlatedPads, bool aSkipNonPlatedPads );
void addFootprintShapes( const FOOTPRINT* aFootprint, CONTAINER_2D_BASE* aDstContainer,
PCB_LAYER_ID aLayerId );
@@ -91,7 +91,7 @@ void BOARD_ADAPTER::addText( const EDA_TEXT* aText, CONTAINER_2D_BASE* aContaine
callback_gal.SetIsFill( font->IsOutline() );
callback_gal.SetIsStroke( font->IsStroke() );
callback_gal.SetLineWidth( attrs.m_StrokeWidth );
font->Draw( &callback_gal, aText->GetShownText(), aText->GetDrawPos(), attrs );
font->Draw( &callback_gal, aText->GetShownText( true ), aText->GetDrawPos(), attrs );
SHAPE_POLY_SET finalPoly;
int margin = attrs.m_StrokeWidth * 1.5 +
@@ -137,7 +137,7 @@ void BOARD_ADAPTER::addText( const EDA_TEXT* aText, CONTAINER_2D_BASE* aContaine
attrs.m_Angle = aText->GetDrawRotation();
font->Draw( &callback_gal, aText->GetShownText(), aText->GetDrawPos(), attrs );
font->Draw( &callback_gal, aText->GetShownText( true ), aText->GetDrawPos(), attrs );
}
}
@@ -145,7 +145,7 @@ void BOARD_ADAPTER::addText( const EDA_TEXT* aText, CONTAINER_2D_BASE* aContaine
void BOARD_ADAPTER::addShape( const PCB_DIMENSION_BASE* aDimension, CONTAINER_2D_BASE* aContainer,
const BOARD_ITEM* aOwner )
{
addText( &aDimension->Text(), aContainer, aDimension );
addText( aDimension, aContainer, aDimension );
const int linewidth = aDimension->GetLineThickness();
@@ -275,6 +275,10 @@ void BOARD_ADAPTER::createTrack( const PCB_TRACK* aTrack, CONTAINER_2D_BASE* aDs
int arcsegcount = GetArcToSegmentCount( radius, ARC_HIGH_DEF, arc_angle );
int circlesegcount;
// Avoid arcs that cannot be drawn
if( radius < std::numeric_limits<double>::min() || arc_angle.IsZero() )
break;
// We need a circle to segment count. However, the arc angle can be small, and the
// radius very big. so we calculate a reasonable value for circlesegcount.
if( arcsegcount <= 1 ) // The arc will be approximated by a segment
@@ -488,41 +492,24 @@ OBJECT_2D* BOARD_ADAPTER::createPadWithDrill( const PAD* aPad, int aInflateValue
void BOARD_ADAPTER::addPads( const FOOTPRINT* aFootprint, CONTAINER_2D_BASE* aContainer,
PCB_LAYER_ID aLayerId, bool aSkipNPTHPadsWihNoCopper,
bool aSkipPlatedPads, bool aSkipNonPlatedPads )
PCB_LAYER_ID aLayerId, bool aSkipPlatedPads, bool aSkipNonPlatedPads )
{
for( PAD* pad : aFootprint->Pads() )
{
if( !pad->IsOnLayer( aLayerId ) )
continue;
// Skip pad annulus when not connected on this layer (if removing is enabled)
if( !pad->FlashLayer( aLayerId ) && IsCopperLayer( aLayerId ) )
continue;
// NPTH pads are not drawn on layers if the shape size and pos is the same as their hole:
if( aSkipNPTHPadsWihNoCopper && ( pad->GetAttribute() == PAD_ATTRIB::NPTH ) )
if( IsCopperLayer( aLayerId ) )
{
if( pad->GetDrillSize() == pad->GetSize() && pad->GetOffset() == wxPoint( 0, 0 ) )
{
switch( pad->GetShape() )
{
case PAD_SHAPE::CIRCLE:
if( pad->GetDrillShape() == PAD_DRILL_SHAPE_CIRCLE )
continue;
// Skip pad annulus when there isn't one (note: this is more discerning than
// pad->IsOnLayer(), which doesn't check for NPTH pads with holes that consume
// the entire pad).
if( !pad->IsOnCopperLayer() )
continue;
break;
case PAD_SHAPE::OVAL:
if( pad->GetDrillShape() != PAD_DRILL_SHAPE_CIRCLE )
continue;
break;
default:
break;
}
}
// Skip pad annulus when not connected on this layer (if removing is enabled)
if( !pad->FlashLayer( aLayerId ) )
continue;
}
VECTOR2I margin( 0, 0 );
+4 -6
View File
@@ -525,9 +525,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
// ADD PADS
for( FOOTPRINT* footprint : m_board->Footprints() )
{
// Note: NPTH pads are not drawn on copper layers when the pad has the same shape
// as its hole
addPads( footprint, layerContainer, layer, true, renderPlatedPadsAsPlated, false );
addPads( footprint, layerContainer, layer, renderPlatedPadsAsPlated, false );
// Micro-wave footprints may have items on copper layers
addFootprintShapes( footprint, layerContainer, layer );
@@ -539,8 +537,8 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
// ADD PLATED PADS
for( FOOTPRINT* footprint : m_board->Footprints() )
{
addPads( footprint, m_platedPadsFront, F_Cu, true, false, true );
addPads( footprint, m_platedPadsBack, B_Cu, true, false, true );
addPads( footprint, m_platedPadsFront, F_Cu, false, true );
addPads( footprint, m_platedPadsBack, B_Cu, false, true );
}
m_platedPadsFront->BuildBVH();
@@ -995,7 +993,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
}
else
{
addPads( footprint, layerContainer, layer, false, false, false );
addPads( footprint, layerContainer, layer, false, false );
}
addFootprintShapes( footprint, layerContainer, layer );
+13 -5
View File
@@ -32,6 +32,7 @@
#include <3d_rendering/raytracing/render_3d_raytrace.h>
#include <3d_rendering/opengl/render_3d_opengl.h>
#include <3d_viewer_id.h>
#include <advanced_config.h>
#include <board.h>
#include <reporter.h>
#include <gl_context_mgr.h>
@@ -140,7 +141,7 @@ EDA_3D_CANVAS::EDA_3D_CANVAS( wxWindow* aParent, const int* aAttribList,
// long calculation time)
m_3d_render = m_3d_render_opengl;
m_boardAdapter.SetColorSettings( Pgm().GetSettingsManager().GetColorSettings() );
m_boardAdapter.ReloadColorSettings();
wxASSERT( a3DCachePointer != nullptr );
m_boardAdapter.Set3dCacheManager( a3DCachePointer );
@@ -303,7 +304,7 @@ void EDA_3D_CANVAS::ReloadRequest( BOARD* aBoard , S3D_CACHE* aCachePointer )
if( aBoard != nullptr )
m_boardAdapter.SetBoard( aBoard );
m_boardAdapter.SetColorSettings( Pgm().GetSettingsManager().GetColorSettings() );
m_boardAdapter.ReloadColorSettings();
if( m_3d_render )
m_3d_render->ReloadRequest();
@@ -383,6 +384,15 @@ void EDA_3D_CANVAS::DoRePaint()
if( m_glRC == nullptr )
m_glRC = GL_CONTEXT_MANAGER::Get().CreateCtx( this );
// CreateCtx could and does fail per sentry crash events, lets be graceful
if( m_glRC == nullptr )
{
warningReporter.Report( _( "OpenGL context creation error" ), RPT_SEVERITY_ERROR );
warningReporter.Finalize();
m_is_currently_painting.clear();
return;
}
GL_CONTEXT_MANAGER::Get().LockCtx( m_glRC, this );
// Set the OpenGL viewport according to the client size of this canvas.
@@ -522,13 +532,11 @@ void EDA_3D_CANVAS::DoRePaint()
render_pivot( curtime_delta_s, scale );
}
#if defined( KICAD_USE_3DCONNEXION )
if( m_render3dmousePivot )
if( m_render3dmousePivot && ADVANCED_CFG::GetCfg().m_Use3DConnexionDriver )
{
const float scale = glm::min( m_camera.GetZoom(), 1.0f );
render3dmousePivot( scale );
}
#endif
// "Swaps the double-buffer of this window, making the back-buffer the
// front-buffer and vice versa, so that the output of the previous OpenGL
-7
View File
@@ -178,8 +178,6 @@ public:
*/
void SetRenderPivot( bool aValue ) { m_render_pivot = aValue; }
#if defined( KICAD_USE_3DCONNEXION )
/**
* Get a value indicating whether to render the 3dmouse pivot.
*/
@@ -209,7 +207,6 @@ public:
{
m_3dmousePivotPos = aPos;
}
#endif
private:
/**
@@ -278,14 +275,12 @@ private:
*/
void render_pivot( float t, float aScale );
#if defined( KICAD_USE_3DCONNEXION )
/**
* Render the 3dmouse pivot cursor.
*
* @param aScale scale to apply on the cursor.
*/
void render3dmousePivot( float aScale );
#endif
/**
* @return true if OpenGL initialization succeeded.
@@ -331,10 +326,8 @@ private:
BOARD_ITEM* m_currentRollOverItem;
#if defined( KICAD_USE_3DCONNEXION )
bool m_render3dmousePivot = false; // Render the 3dmouse pivot
SFVEC3F m_3dmousePivotPos; // The position of the 3dmouse pivot
#endif
/**
* Trace mask used to enable or disable the trace output of this class.
@@ -120,7 +120,6 @@ void EDA_3D_CANVAS::render_pivot( float t, float aScale )
}
#if defined( KICAD_USE_3DCONNEXION )
void EDA_3D_CANVAS::render3dmousePivot( float aScale )
{
wxASSERT( aScale >= 0.0f );
@@ -160,4 +159,3 @@ void EDA_3D_CANVAS::render3dmousePivot( float aScale )
glDisable( GL_BLEND );
glDisable( GL_POINT_SMOOTH );
}
#endif
@@ -257,6 +257,13 @@ void EDA_3D_MODEL_VIEWER::OnPaint( wxPaintEvent& event )
if( m_glRC == nullptr )
m_glRC = GL_CONTEXT_MANAGER::Get().CreateCtx( this );
// CreateCtx could and does fail per sentry crash events, lets be graceful
if( m_glRC == nullptr )
{
wxLogTrace( m_logTrace, wxT( "EDA_3D_MODEL_VIEWER::OnPaint creating gl context failed" ) );
return;
}
GL_CONTEXT_MANAGER::Get().LockCtx( m_glRC, this );
// Set the OpenGL viewport according to the client size of this canvas.
@@ -323,8 +330,16 @@ void EDA_3D_MODEL_VIEWER::OnPaint( wxPaintEvent& event )
m_ogl_3dmodel->BeginDrawMulti( true );
m_ogl_3dmodel->DrawOpaque( false );
glDepthMask( GL_FALSE );
glEnable( GL_BLEND );
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
m_ogl_3dmodel->DrawTransparent( 1.0f, false );
glDisable( GL_BLEND );
glDepthMask( GL_TRUE );
m_ogl_3dmodel->EndDrawMulti();
glPopMatrix();
-6
View File
@@ -1,4 +1,3 @@
if( KICAD_USE_3DCONNEXION )
add_library(3d-viewer_navlib STATIC
"nl_3d_viewer_plugin.cpp"
"nl_3d_viewer_plugin_impl.cpp"
@@ -23,9 +22,4 @@ if( KICAD_USE_3DCONNEXION )
$<TARGET_PROPERTY:3DxWare::Navlib,INTERFACE_LINK_LIBRARIES>
3DxWare::Navlib
)
else()
add_library(3d-viewer_navlib STATIC
"nl_3d_viewer_plugin.cpp"
)
endif(KICAD_USE_3DCONNEXION)
+6 -22
View File
@@ -19,14 +19,14 @@
*/
#include "nl_3d_viewer_plugin.h"
#if defined( KICAD_USE_3DCONNEXION )
#include "nl_3d_viewer_plugin_impl.h"
#include <advanced_config.h>
NL_3D_VIEWER_PLUGIN::NL_3D_VIEWER_PLUGIN( EDA_3D_CANVAS* aViewport ) :
m_impl( new NL_3D_VIEWER_PLUGIN_IMPL( aViewport ) )
NL_3D_VIEWER_PLUGIN::NL_3D_VIEWER_PLUGIN( EDA_3D_CANVAS* aViewport )
{
if( ADVANCED_CFG::GetCfg().m_Use3DConnexionDriver )
m_impl = new NL_3D_VIEWER_PLUGIN_IMPL( aViewport );
}
@@ -38,22 +38,6 @@ NL_3D_VIEWER_PLUGIN::~NL_3D_VIEWER_PLUGIN()
void NL_3D_VIEWER_PLUGIN::SetFocus( bool focus )
{
m_impl->SetFocus( focus );
if( ADVANCED_CFG::GetCfg().m_Use3DConnexionDriver )
m_impl->SetFocus( focus );
}
#else
NL_3D_VIEWER_PLUGIN::NL_3D_VIEWER_PLUGIN( EDA_3D_CANVAS* aViewport ) : m_impl( nullptr )
{
}
void NL_3D_VIEWER_PLUGIN::SetFocus( bool focus )
{
}
NL_3D_VIEWER_PLUGIN::~NL_3D_VIEWER_PLUGIN()
{
}
#endif
+98 -15
View File
@@ -27,13 +27,14 @@
* @file c_ogl_3dmodel.cpp
* @brief
*/
#include <algorithm>
#include <stdexcept>
#include <gal/opengl/kiglew.h> // Must be included first
#include "3d_model.h"
#include "opengl_utils.h"
#include "../common_ogl/ogl_utils.h"
#include "../3d_math.h"
#include <utility>
#include <wx/debug.h>
#include <wx/log.h>
#include <chrono>
@@ -177,9 +178,11 @@ MODEL_3D::MODEL_3D( const S3DMODEL& a3DModel, MATERIAL_MODE aMaterialMode )
// use material color for mesh bounding box or some sort of average vertex color.
glm::vec3 avg_color = material.m_Diffuse;
BBOX_3D &mesh_bbox = m_meshes_bbox[mesh_i];
for( unsigned int vtx_i = 0; vtx_i < mesh.m_VertexSize; ++vtx_i )
{
m_meshes_bbox[mesh_i].Union( mesh.m_Positions[vtx_i] );
mesh_bbox.Union( mesh.m_Positions[vtx_i] );
VERTEX& vtx_out = mesh_group.m_vertices[vtx_offset + vtx_i];
@@ -222,16 +225,19 @@ MODEL_3D::MODEL_3D( const S3DMODEL& a3DModel, MATERIAL_MODE aMaterialMode )
}
}
if( m_meshes_bbox[mesh_i].IsInitialized() )
if( mesh_bbox.IsInitialized() )
{
// generate geometry for the bounding box
MakeBbox( m_meshes_bbox[mesh_i], ( mesh_i + 1 ) * bbox_vtx_count,
MakeBbox( mesh_bbox, ( mesh_i + 1 ) * bbox_vtx_count,
&bbox_tmp_vertices[( mesh_i + 1 ) * bbox_vtx_count],
&bbox_tmp_indices[( mesh_i + 1 ) * bbox_idx_count],
{ avg_color, 1.0f } );
// bump the outer bounding box
m_model_bbox.Union( m_meshes_bbox[mesh_i] );
m_model_bbox.Union( mesh_bbox );
// add to the material group
material.m_bbox.Union( mesh_bbox );
}
@@ -410,7 +416,9 @@ void MODEL_3D::EndDrawMulti()
void MODEL_3D::Draw( bool aTransparent, float aOpacity, bool aUseSelectedMaterial,
SFVEC3F& aSelectionColor ) const
const SFVEC3F& aSelectionColor,
const glm::mat4 *aModelWorldMatrix,
const SFVEC3F *aCameraWorldPos ) const
{
if( aOpacity <= FLT_EPSILON )
return;
@@ -439,27 +447,102 @@ void MODEL_3D::Draw( bool aTransparent, float aOpacity, bool aUseSelectedMateria
glTexEnvfv( GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, (const float*)&param.x );
for( const MODEL_3D::MATERIAL& mat : m_materials )
std::vector<const MODEL_3D::MATERIAL *> materialsToRender;
materialsToRender.reserve( m_materials.size() );
if( aModelWorldMatrix && aCameraWorldPos )
{
if( ( mat.IsTransparent() != aTransparent )
// Sort Material groups
std::vector<std::pair<const MODEL_3D::MATERIAL*, float>> materialsSorted;
// Calculate the distance to the camera for each material group
for( const MODEL_3D::MATERIAL& mat : m_materials )
{
if( mat.m_render_idx_count == 0 )
{
continue;
}
if( ( mat.IsTransparent() != aTransparent )
&& ( aOpacity >= 1.0f )
&& m_materialMode != MATERIAL_MODE::DIFFUSE_ONLY )
{
continue;
{
continue;
}
const BBOX_3D& bBox = mat.m_bbox;
const SFVEC3F& bBoxCenter = bBox.GetCenter();
const SFVEC3F bBoxWorld = *aModelWorldMatrix * glm::vec4( bBoxCenter, 1.0f );
const float distanceToCamera = glm::length( *aCameraWorldPos - bBoxWorld );
materialsSorted.emplace_back( &mat, distanceToCamera );
}
// Sort from back to front
std::sort( materialsSorted.begin(), materialsSorted.end(),
[&]( std::pair<const MODEL_3D::MATERIAL*, float>& a,
std::pair<const MODEL_3D::MATERIAL*, float>& b ) {
// If A is inside B, then A is rendered first
if( b.first->m_bbox.Inside( a.first->m_bbox ) )
{
return true;
}
else
{
if( a.first->m_bbox.Inside( b.first->m_bbox ) )
{
return false;
}
}
return a.second > b.second;
} );
for( const std::pair<const MODEL_3D::MATERIAL*, float>& mat : materialsSorted )
{
materialsToRender.push_back( mat.first );
}
}
else
{
for( const MODEL_3D::MATERIAL& mat : m_materials )
{
// There is at least one default material created in case a mesh has no declared materials.
// Most meshes have a material, so usually the first material will have nothing to render and is skip.
// See S3D::GetModel for more details.
if( mat.m_render_idx_count == 0 )
{
continue;
}
if( ( mat.IsTransparent() != aTransparent )
&& ( aOpacity >= 1.0f )
&& m_materialMode != MATERIAL_MODE::DIFFUSE_ONLY )
{
continue;
}
materialsToRender.push_back( &mat );
}
}
for( const MODEL_3D::MATERIAL* mat : materialsToRender )
{
switch( m_materialMode )
{
case MATERIAL_MODE::NORMAL:
OglSetMaterial( mat, aOpacity, aUseSelectedMaterial, aSelectionColor );
OglSetMaterial( *mat, aOpacity, aUseSelectedMaterial, aSelectionColor );
break;
case MATERIAL_MODE::DIFFUSE_ONLY:
OglSetDiffuseMaterial( mat.m_Diffuse, aOpacity, aUseSelectedMaterial, aSelectionColor );
OglSetDiffuseMaterial( mat->m_Diffuse, aOpacity, aUseSelectedMaterial, aSelectionColor );
break;
case MATERIAL_MODE::CAD_MODE:
OglSetDiffuseMaterial( MaterialDiffuseToColorCAD( mat.m_Diffuse ), aOpacity,
OglSetDiffuseMaterial( MaterialDiffuseToColorCAD( mat->m_Diffuse ), aOpacity,
aUseSelectedMaterial, aSelectionColor );
break;
@@ -467,9 +550,9 @@ void MODEL_3D::Draw( bool aTransparent, float aOpacity, bool aUseSelectedMateria
break;
}
glDrawElements( GL_TRIANGLES, mat.m_render_idx_count, m_index_buffer_type,
glDrawElements( GL_TRIANGLES, mat->m_render_idx_count, m_index_buffer_type,
reinterpret_cast<const void*>(
static_cast<uintptr_t>( mat.m_render_idx_buffer_offset ) ) );
static_cast<uintptr_t>( mat->m_render_idx_buffer_offset ) ) );
}
}
+14 -5
View File
@@ -54,7 +54,7 @@ public:
*/
void DrawOpaque( bool aUseSelectedMaterial, SFVEC3F aSelectionColor = SFVEC3F( 0.0f ) ) const
{
Draw( false, 1.0f, aUseSelectedMaterial, aSelectionColor );
Draw( false, 1.0f, aUseSelectedMaterial, aSelectionColor, nullptr, nullptr );
}
/**
@@ -63,9 +63,19 @@ public:
void DrawTransparent( float aOpacity, bool aUseSelectedMaterial,
SFVEC3F aSelectionColor = SFVEC3F( 0.0f ) ) const
{
Draw( true, aOpacity, aUseSelectedMaterial, aSelectionColor );
Draw( true, aOpacity, aUseSelectedMaterial, aSelectionColor, nullptr, nullptr );
}
/**
* Render the model into the current context.
* if aModelWorldMatrix and aCameraWorldPos is provided,
* it renders the material groups sorted.
*/
void Draw( bool aTransparent, float aOpacity, bool aUseSelectedMaterial,
const SFVEC3F& aSelectionColor,
const glm::mat4 *aModelWorldMatrix,
const SFVEC3F *aCameraWorldPos ) const;
/**
* Return true if have opaque meshes to render.
*/
@@ -136,6 +146,8 @@ private:
unsigned int m_render_idx_buffer_offset = 0;
unsigned int m_render_idx_count = 0;
BBOX_3D m_bbox; ///< bounding box for this material group, used for transparent material ordering
MATERIAL( const SMATERIAL& aOther ) : SMATERIAL( aOther ) { }
bool IsTransparent() const { return m_Transparency > FLT_EPSILON; }
};
@@ -159,9 +171,6 @@ private:
static void MakeBbox( const BBOX_3D& aBox, unsigned int aIdxOffset, VERTEX* aVtxOut,
GLuint* aIdxOut, const glm::vec4& aColor );
void Draw( bool aTransparent, float aOpacity, bool aUseSelectedMaterial,
SFVEC3F& aSelectionColor ) const;
};
#endif // _MODEL_3D_H_
@@ -912,7 +912,8 @@ void RENDER_3D_OPENGL::load3dModels( REPORTER* aStatusReporter )
if( !m_boardAdapter.GetBoard() )
return;
if( !m_boardAdapter.m_Cfg->m_Render.show_footprints_normal
if( !m_boardAdapter.m_IsPreviewer
&& !m_boardAdapter.m_Cfg->m_Render.show_footprints_normal
&& !m_boardAdapter.m_Cfg->m_Render.show_footprints_insert
&& !m_boardAdapter.m_Cfg->m_Render.show_footprints_virtual )
{
@@ -22,14 +22,19 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <cstdint>
#include <gal/opengl/kiglew.h> // Must be included first
#include "plugins/3dapi/xv3d_types.h"
#include "render_3d_opengl.h"
#include "opengl_utils.h"
#include "common_ogl/ogl_utils.h"
#include <footprint.h>
#include <3d_math.h>
#include <glm/geometric.hpp>
#include <math/util.h> // for KiROUND
#include <utility>
#include <vector>
#include <wx/log.h>
#include <base_units.h>
@@ -858,9 +863,12 @@ bool RENDER_3D_OPENGL::Redraw( bool aIsMoving, REPORTER* aStatusReporter,
glPopMatrix();
}
glm::mat4 cameraViewMatrix;
glGetFloatv( GL_MODELVIEW_MATRIX, glm::value_ptr( cameraViewMatrix ) );
// Render 3D Models (Non-transparent)
render3dModels( false, false );
render3dModels( true, false );
renderOpaqueModels( cameraViewMatrix );
// Display board body
if( m_boardAdapter.m_Cfg->m_Render.show_board_body )
@@ -922,8 +930,7 @@ bool RENDER_3D_OPENGL::Redraw( bool aIsMoving, REPORTER* aStatusReporter,
glTexEnvi( GL_TEXTURE_ENV, GL_SRC1_ALPHA, GL_CONSTANT );
glTexEnvi( GL_TEXTURE_ENV, GL_OPERAND1_ALPHA, GL_SRC_ALPHA );
render3dModels( false, true );
render3dModels( true, true );
renderTransparentModels( cameraViewMatrix );
glDisable( GL_BLEND );
OglResetTextureState();
@@ -1143,14 +1150,15 @@ void RENDER_3D_OPENGL::renderSolderMaskLayer( PCB_LAYER_ID aLayerID, float aZPos
}
void RENDER_3D_OPENGL::render3dModelsSelected( bool aRenderTopOrBot, bool aRenderTransparentOnly,
bool aRenderSelectedOnly )
void RENDER_3D_OPENGL::get3dModelsSelected( std::list<MODELTORENDER> &aDstRenderList,
bool aGetTop, bool aGetBot, bool aRenderTransparentOnly,
bool aRenderSelectedOnly )
{
wxASSERT( ( aGetTop == true ) || ( aGetBot == true ) );
if( !m_boardAdapter.GetBoard() )
return;
MODEL_3D::BeginDrawMulti( !aRenderSelectedOnly );
// Go for all footprints
for( FOOTPRINT* fp : m_boardAdapter.GetBoard()->Footprints() )
{
@@ -1175,54 +1183,52 @@ void RENDER_3D_OPENGL::render3dModelsSelected( bool aRenderTopOrBot, bool aRende
{
if( m_boardAdapter.IsFootprintShown( (FOOTPRINT_ATTR_T) fp->GetAttributes() ) )
{
if( aRenderTopOrBot == !fp->IsFlipped() )
renderFootprint( fp, aRenderTransparentOnly, highlight );
const bool isFlipped = fp->IsFlipped();
if( ( aGetTop == !isFlipped ) ||
( aGetBot == isFlipped ) )
get3dModelsFromFootprint( aDstRenderList, fp, aRenderTransparentOnly, highlight );
}
}
}
MODEL_3D::EndDrawMulti();
}
void RENDER_3D_OPENGL::render3dModels( bool aRenderTopOrBot, bool aRenderTransparentOnly )
{
if( m_boardAdapter.m_IsBoardView )
render3dModelsSelected( aRenderTopOrBot, aRenderTransparentOnly, true );
render3dModelsSelected( aRenderTopOrBot, aRenderTransparentOnly, false );
}
void RENDER_3D_OPENGL::renderFootprint( const FOOTPRINT* aFootprint, bool aRenderTransparentOnly,
bool aIsSelected )
void RENDER_3D_OPENGL::get3dModelsFromFootprint( std::list<MODELTORENDER> &aDstRenderList,
const FOOTPRINT* aFootprint, bool aRenderTransparentOnly,
bool aIsSelected )
{
if( !aFootprint->Models().empty() )
{
const double zpos = m_boardAdapter.GetFootprintZPos( aFootprint->IsFlipped() );
SFVEC3F selColor = m_boardAdapter.GetColor( m_boardAdapter.m_Cfg->m_Render.opengl_selection_color );
glPushMatrix();
VECTOR2I pos = aFootprint->GetPosition();
glTranslatef( pos.x * m_boardAdapter.BiuTo3dUnits(), -pos.y * m_boardAdapter.BiuTo3dUnits(),
zpos );
glm::mat4 fpMatrix( 1.0f );
fpMatrix = glm::translate( fpMatrix,
SFVEC3F( pos.x * m_boardAdapter.BiuTo3dUnits(),
-pos.y * m_boardAdapter.BiuTo3dUnits(),
zpos ) );
if( !aFootprint->GetOrientation().IsZero() )
glRotated( aFootprint->GetOrientation().AsDegrees(), 0.0, 0.0, 1.0 );
{
fpMatrix = glm::rotate( fpMatrix,
(float) aFootprint->GetOrientation().AsRadians(),
SFVEC3F( 0.0f, 0.0f, 1.0f ) );
}
if( aFootprint->IsFlipped() )
{
glRotatef( 180.0f, 0.0f, 1.0f, 0.0f );
glRotatef( 180.0f, 0.0f, 0.0f, 1.0f );
fpMatrix = glm::rotate( fpMatrix, glm::pi<float>(), SFVEC3F( 0.0f, 1.0f, 0.0f ) );
fpMatrix = glm::rotate( fpMatrix, glm::pi<float>(), SFVEC3F( 0.0f, 0.0f, 1.0f ) );
}
double modelunit_to_3d_units_factor = m_boardAdapter.BiuTo3dUnits() * UNITS3D_TO_UNITSPCB;
const double modelunit_to_3d_units_factor = m_boardAdapter.BiuTo3dUnits() *
UNITS3D_TO_UNITSPCB;
glScaled( modelunit_to_3d_units_factor, modelunit_to_3d_units_factor,
modelunit_to_3d_units_factor );
fpMatrix = glm::scale( fpMatrix,
SFVEC3F( modelunit_to_3d_units_factor ) );
// Get the list of model files for this model
for( const FP_3DMODEL& sM : aFootprint->Models() )
@@ -1243,66 +1249,232 @@ void RENDER_3D_OPENGL::renderFootprint( const FOOTPRINT* aFootprint, bool aRende
if( ( !aRenderTransparentOnly && modelPtr->HasOpaqueMeshes() && opaque ) ||
( aRenderTransparentOnly && ( modelPtr->HasTransparentMeshes() || !opaque ) ) )
{
glPushMatrix();
glm::mat4 modelworldMatrix = fpMatrix;
std::vector<double> key = { sM.m_Offset.x, sM.m_Offset.y, sM.m_Offset.z,
sM.m_Rotation.x, sM.m_Rotation.y, sM.m_Rotation.z,
sM.m_Scale.x, sM.m_Scale.y, sM.m_Scale.z };
const SFVEC3F offset = SFVEC3F( sM.m_Offset.x, sM.m_Offset.y, sM.m_Offset.z );
const SFVEC3F rotation = SFVEC3F( sM.m_Rotation.x, sM.m_Rotation.y, sM.m_Rotation.z );
const SFVEC3F scale = SFVEC3F( sM.m_Scale.x, sM.m_Scale.y, sM.m_Scale.z );
std::vector<float> key = { offset.x, offset.y, offset.z,
rotation.x, rotation.y, rotation.z,
scale.x, scale.y, scale.z };
auto it = m_3dModelMatrixMap.find( key );
if( it != m_3dModelMatrixMap.end() )
{
glMultMatrixf( glm::value_ptr( it->second ) );
modelworldMatrix *= it->second;
}
else
{
glm::mat4 mtx( 1 );
mtx = glm::translate( mtx, { sM.m_Offset.x, sM.m_Offset.y, sM.m_Offset.z } );
mtx = glm::rotate( mtx, glm::radians( (float) -sM.m_Rotation.z ), { 0.0f, 0.0f, 1.0f } );
mtx = glm::rotate( mtx, glm::radians( (float) -sM.m_Rotation.y ), { 0.0f, 1.0f, 0.0f } );
mtx = glm::rotate( mtx, glm::radians( (float) -sM.m_Rotation.x ), { 1.0f, 0.0f, 0.0f } );
mtx = glm::scale( mtx, { sM.m_Scale.x, sM.m_Scale.y, sM.m_Scale.z } );
glm::mat4 mtx( 1.0f );
mtx = glm::translate( mtx, offset );
mtx = glm::rotate( mtx, glm::radians( -rotation.z ), { 0.0f, 0.0f, 1.0f } );
mtx = glm::rotate( mtx, glm::radians( -rotation.y ), { 0.0f, 1.0f, 0.0f } );
mtx = glm::rotate( mtx, glm::radians( -rotation.x ), { 1.0f, 0.0f, 0.0f } );
mtx = glm::scale( mtx, scale );
m_3dModelMatrixMap[ key ] = mtx;
glMultMatrixf( glm::value_ptr( mtx ) );
modelworldMatrix *= mtx;
}
if( aRenderTransparentOnly )
{
modelPtr->DrawTransparent( sM.m_Opacity,
aFootprint->IsSelected() || aIsSelected,
selColor );
aDstRenderList.emplace_back( modelworldMatrix,
modelPtr,
sM.m_Opacity,
true,
aFootprint->IsSelected() || aIsSelected );
}
else
{
modelPtr->DrawOpaque( aFootprint->IsSelected() || aIsSelected, selColor );
aDstRenderList.emplace_back( modelworldMatrix,
modelPtr,
1.0f,
false,
aFootprint->IsSelected() || aIsSelected );
}
}
}
}
}
}
if( m_boardAdapter.m_Cfg->m_Render.opengl_show_model_bbox )
{
glEnable( GL_BLEND );
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
glDisable( GL_LIGHTING );
void RENDER_3D_OPENGL::renderOpaqueModels( const glm::mat4 &aCameraViewMatrix )
{
const SFVEC3F selColor = m_boardAdapter.GetColor( m_boardAdapter.m_Cfg->m_Render.opengl_selection_color );
glLineWidth( 1 );
modelPtr->DrawBboxes();
glPushMatrix();
glLineWidth( 4 );
modelPtr->DrawBbox();
std::list<MODELTORENDER> renderList;
glEnable( GL_LIGHTING );
glDisable( GL_BLEND );
}
if( m_boardAdapter.m_IsBoardView )
{
renderList.clear();
glPopMatrix();
get3dModelsSelected( renderList, true, true, false, true );
if( !renderList.empty() )
{
MODEL_3D::BeginDrawMulti( false );
for( const MODELTORENDER& mtr : renderList )
{
renderModel( aCameraViewMatrix, mtr, selColor, nullptr );
}
MODEL_3D::EndDrawMulti();
}
}
renderList.clear();
get3dModelsSelected( renderList, true, true, false, false );
if( !renderList.empty() )
{
MODEL_3D::BeginDrawMulti( true );
for( const MODELTORENDER& mtr : renderList )
{
renderModel( aCameraViewMatrix, mtr, selColor, nullptr );
}
MODEL_3D::EndDrawMulti();
}
glPopMatrix();
}
void RENDER_3D_OPENGL::renderTransparentModels( const glm::mat4 &aCameraViewMatrix )
{
const SFVEC3F selColor = m_boardAdapter.GetColor( m_boardAdapter.m_Cfg->m_Render.opengl_selection_color );
std::list<MODELTORENDER> renderListModels; // do not clear it until this function returns
if( m_boardAdapter.m_IsBoardView )
{
// Get Transparent Selected
get3dModelsSelected( renderListModels, true, true, true, true );
}
// Get Transparent Not Selected
get3dModelsSelected( renderListModels, true, true, true, false );
if( renderListModels.empty() )
return;
std::vector<std::pair<const MODELTORENDER *, float>> transparentModelList;
transparentModelList.reserve( renderListModels.size() );
// Calculate the distance to the camera for each model
const SFVEC3F &cameraPos = m_camera.GetPos();
for( const MODELTORENDER& mtr : renderListModels )
{
const BBOX_3D& bBox = mtr.m_model->GetBBox();
const SFVEC3F& bBoxCenter = bBox.GetCenter();
const SFVEC3F bBoxWorld = mtr.m_modelWorldMat * glm::vec4( bBoxCenter, 1.0f );
const float distanceToCamera = glm::length( cameraPos - bBoxWorld );
transparentModelList.emplace_back( &mtr, distanceToCamera );
}
// Sort from back to front
std::sort( transparentModelList.begin(), transparentModelList.end(),
[&]( std::pair<const MODELTORENDER *, float>& a,
std::pair<const MODELTORENDER *, float>& b ) {
return a.second > b.second;
} );
// Start rendering calls
glPushMatrix();
bool isUsingColorInformation = !( transparentModelList.begin()->first->m_isSelected &&
m_boardAdapter.m_IsBoardView );
MODEL_3D::BeginDrawMulti( isUsingColorInformation );
for( const std::pair<const MODELTORENDER *, float>& mtr : transparentModelList )
{
if( m_boardAdapter.m_IsBoardView )
{
// Toggle between using model color or the select color
if( !isUsingColorInformation && !mtr.first->m_isSelected )
{
isUsingColorInformation = true;
glEnableClientState( GL_COLOR_ARRAY );
glEnableClientState( GL_TEXTURE_COORD_ARRAY );
glEnable( GL_COLOR_MATERIAL );
}
else
{
if( isUsingColorInformation && mtr.first->m_isSelected )
{
isUsingColorInformation = false;
glDisableClientState( GL_COLOR_ARRAY );
glDisableClientState( GL_TEXTURE_COORD_ARRAY );
glDisable( GL_COLOR_MATERIAL );
}
}
}
glPopMatrix();
// Render model, sort each individuall material group
// by passing cameraPos
renderModel( aCameraViewMatrix, *mtr.first, selColor, &cameraPos );
}
MODEL_3D::EndDrawMulti();
glPopMatrix();
}
void RENDER_3D_OPENGL::renderModel( const glm::mat4 &aCameraViewMatrix,
const MODELTORENDER &aModelToRender,
const SFVEC3F &aSelColor,
const SFVEC3F *aCameraWorldPos )
{
const glm::mat4 modelviewMatrix = aCameraViewMatrix * aModelToRender.m_modelWorldMat;
glLoadMatrixf( glm::value_ptr( modelviewMatrix ) );
aModelToRender.m_model->Draw( aModelToRender.m_isTransparent,
aModelToRender.m_opacity,
aModelToRender.m_isSelected,
aSelColor,
&aModelToRender.m_modelWorldMat,
aCameraWorldPos );
if( m_boardAdapter.m_Cfg->m_Render.opengl_show_model_bbox )
{
const bool wasBlendEnabled = glIsEnabled( GL_BLEND );
if( !wasBlendEnabled )
{
glEnable( GL_BLEND );
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
}
glDisable( GL_LIGHTING );
glLineWidth( 1 );
aModelToRender.m_model->DrawBboxes();
glLineWidth( 4 );
aModelToRender.m_model->DrawBbox();
glEnable( GL_LIGHTING );
if( !wasBlendEnabled )
{
glDisable( GL_BLEND );
}
}
}
@@ -129,18 +129,44 @@ private:
*/
void load3dModels( REPORTER* aStatusReporter );
/**
* @param aRenderTopOrBot true will render Top, false will render bottom
* @param aRenderTransparentOnly true will render only the transparent objects, false will
* render opaque
*/
void render3dModels( bool aRenderTopOrBot, bool aRenderTransparentOnly );
struct MODELTORENDER
{
glm::mat4 m_modelWorldMat;
const MODEL_3D* m_model;
float m_opacity;
bool m_isTransparent;
bool m_isSelected;
void render3dModelsSelected( bool aRenderTopOrBot, bool aRenderTransparentOnly,
bool aRenderSelectedOnly );
MODELTORENDER( glm::mat4 aModelWorldMat,
const MODEL_3D* aNodel,
float aOpacity,
bool aIsTransparent,
bool aIsSelected ) :
m_modelWorldMat( std::move( aModelWorldMat ) ),
m_model( aNodel ),
m_opacity( aOpacity ),
m_isTransparent( aIsTransparent ),
m_isSelected( aIsSelected )
{
}
};
void renderFootprint( const FOOTPRINT* aFootprint, bool aRenderTransparentOnly,
bool aIsSelected );
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 get3dModelsSelected( std::list<MODELTORENDER> &aDstRenderList,
bool aGetTop, bool aGetBot, bool aRenderTransparentOnly,
bool aRenderSelectedOnly );
void get3dModelsFromFootprint( std::list<MODELTORENDER> &aDstRenderList,
const FOOTPRINT* aFootprint, bool aRenderTransparentOnly,
bool aIsSelected );
void setLightFront( bool enabled );
void setLightTop( bool enabled );
@@ -210,7 +236,7 @@ private:
// Caches
std::map< wxString, MODEL_3D* > m_3dModelMap;
std::map< std::vector<double>, glm::mat4 > m_3dModelMatrixMap;
std::map< std::vector<float>, glm::mat4 > m_3dModelMatrixMap;
BOARD_ITEM* m_currentRollOverItem;
@@ -1202,7 +1202,8 @@ void RENDER_3D_RAYTRACE::load3DModels( CONTAINER_3D& aDstContainer, bool aSkipMa
if( !m_boardAdapter.GetBoard() )
return;
if( !m_boardAdapter.m_Cfg->m_Render.show_footprints_normal
if( !m_boardAdapter.m_IsPreviewer
&& !m_boardAdapter.m_Cfg->m_Render.show_footprints_normal
&& !m_boardAdapter.m_Cfg->m_Render.show_footprints_insert
&& !m_boardAdapter.m_Cfg->m_Render.show_footprints_virtual )
{
@@ -229,6 +229,16 @@ bool BBOX_2D::Inside( const SFVEC2F& aPoint ) const
}
bool BBOX_2D::Inside( const BBOX_2D& aBBox ) const
{
wxASSERT( IsInitialized() );
wxASSERT( aBBox.IsInitialized() );
return Inside( aBBox.Min() ) &&
Inside( aBBox.Max() );
}
float BBOX_2D::Area() const
{
SFVEC2F extent = GetExtent();
@@ -132,6 +132,14 @@ public:
*/
bool Inside( const SFVEC2F& aPoint ) const;
/**
* Check if a bounding box is inside this bounding box.
*
* @param aBBox the bounding box to test if it is inside
* @return true if aBBox is smaller and all points are inside
*/
bool Inside( const BBOX_2D& aBBox ) const;
/**
* Calculate the area of a bounding box.
*
@@ -238,6 +238,16 @@ bool BBOX_3D::Inside( const SFVEC3F& aPoint ) const
}
bool BBOX_3D::Inside( const BBOX_3D& aBBox ) const
{
wxASSERT( IsInitialized() );
wxASSERT( aBBox.IsInitialized() );
return Inside( aBBox.Min() ) &&
Inside( aBBox.Max() );
}
float BBOX_3D::Volume() const
{
wxASSERT( IsInitialized() );
@@ -125,6 +125,14 @@ public:
*/
bool Inside( const SFVEC3F& aPoint ) const;
/**
* Check if a bounding box is inside this bounding box.
*
* @param aBBox the bounding box to test if it is inside
* @return true if aBBox is smaller and all points are inside
*/
bool Inside( const BBOX_3D& aBBox ) const;
/**
* Apply a transformation matrix to the box points.
*
+15 -24
View File
@@ -39,6 +39,7 @@
#include <3d_viewer/tools/eda_3d_actions.h>
#include <3d_viewer/tools/eda_3d_controller.h>
#include <3d_viewer/tools/eda_3d_conditions.h>
#include <advanced_config.h>
#include <bitmaps.h>
#include <board_design_settings.h>
#include <core/arraydim.h>
@@ -56,9 +57,7 @@
#include <widgets/wx_infobar.h>
#include <wildcards_and_files_ext.h>
#if defined( KICAD_USE_3DCONNEXION )
#include <3d_navlib/nl_3d_viewer_plugin.h>
#endif
/**
* Flag to enable 3D viewer main frame window debug tracing.
@@ -166,16 +165,18 @@ EDA_3D_VIEWER_FRAME::EDA_3D_VIEWER_FRAME( KIWAY* aKiway, PCB_BASE_FRAME* aParent
m_canvas->SetInfoBar( m_infoBar );
m_canvas->SetStatusBar( status_bar );
#if defined( KICAD_USE_3DCONNEXION )
try
if( ADVANCED_CFG::GetCfg().m_Use3DConnexionDriver )
{
m_spaceMouse = new NL_3D_VIEWER_PLUGIN( m_canvas );
try
{
m_spaceMouse = new NL_3D_VIEWER_PLUGIN( m_canvas );
}
catch( const std::system_error& e )
{
wxLogTrace( wxT( "KI_TRACE_NAVLIB" ), e.what() );
}
}
catch( const std::system_error& e )
{
wxLogTrace( wxT( "KI_TRACE_NAVLIB" ), e.what() );
}
#endif
// 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
@@ -193,12 +194,7 @@ EDA_3D_VIEWER_FRAME::EDA_3D_VIEWER_FRAME( KIWAY* aKiway, PCB_BASE_FRAME* aParent
EDA_3D_VIEWER_FRAME::~EDA_3D_VIEWER_FRAME()
{
#if defined( KICAD_USE_3DCONNEXION )
if( m_spaceMouse != nullptr )
{
delete m_spaceMouse;
}
#endif
delete m_spaceMouse;
Prj().GetProjectFile().m_Viewports3D = GetUserViewports();
@@ -334,12 +330,11 @@ void EDA_3D_VIEWER_FRAME::handleIconizeEvent( wxIconizeEvent& aEvent )
{
KIWAY_PLAYER::handleIconizeEvent( aEvent );
#if defined( KICAD_USE_3DCONNEXION )
if( m_spaceMouse != nullptr && aEvent.IsIconized() )
if( m_spaceMouse != nullptr && aEvent.IsIconized()
&& ADVANCED_CFG::GetCfg().m_Use3DConnexionDriver )
{
m_spaceMouse->SetFocus( false );
}
#endif
}
@@ -655,12 +650,8 @@ void EDA_3D_VIEWER_FRAME::OnActivate( wxActivateEvent &aEvent )
m_canvas->SetFocus();
}
#if defined( KICAD_USE_3DCONNEXION )
if( m_spaceMouse != nullptr )
{
if( m_spaceMouse != nullptr && ADVANCED_CFG::GetCfg().m_Use3DConnexionDriver )
m_spaceMouse->SetFocus( aEvent.GetActive() );
}
#endif
aEvent.Skip(); // required under wxMAC
}
+3 -5
View File
@@ -122,8 +122,6 @@ target_link_libraries( 3d-viewer
add_subdirectory( 3d_cache )
if( KICAD_USE_3DCONNEXION )
message( STATUS "Including 3Dconnexion SpaceMouse navigation support in 3d-viewer" )
add_subdirectory( 3d_navlib )
target_link_libraries( 3d-viewer PRIVATE 3d-viewer_navlib)
endif()
message( STATUS "Including 3Dconnexion SpaceMouse navigation support in 3d-viewer" )
add_subdirectory( 3d_navlib )
target_link_libraries( 3d-viewer PRIVATE 3d-viewer_navlib)
+31 -1
View File
@@ -56,20 +56,24 @@ PANEL_PREVIEW_3D_MODEL::PANEL_PREVIEW_3D_MODEL( wxWindow* aParent, PCB_BASE_FRAM
m_userUnits = aFrame->GetUserUnits();
m_dummyBoard = new BOARD();
m_dummyBoard->SetProject( &aFrame->Prj(), true );
// This board will only be used to hold a footprint for viewing
m_dummyBoard->SetBoardUse( BOARD_USE::FPHOLDER );
BOARD_DESIGN_SETTINGS parent_bds = aFrame->GetDesignSettings();
BOARD_DESIGN_SETTINGS dummy_bds = m_dummyBoard->GetDesignSettings();
BOARD_DESIGN_SETTINGS& dummy_bds = m_dummyBoard->GetDesignSettings();
dummy_bds.SetBoardThickness( parent_bds.GetBoardThickness() );
dummy_bds.SetEnabledLayers( LSET::FrontMask() | LSET::BackMask() );
BOARD_STACKUP& dummy_board_stackup = m_dummyBoard->GetDesignSettings().GetStackupDescriptor();
dummy_board_stackup.RemoveAll();
dummy_board_stackup.BuildDefaultStackupList( &dummy_bds, 2 );
m_selected = -1;
m_previewLabel->SetFont( KIUI::GetStatusFont( this ) );
// Set the bitmap of 3D view buttons:
m_bpvTop->SetBitmap( KiBitmap( BITMAPS::axis3d_top ) );
m_bpvFront->SetBitmap( KiBitmap( BITMAPS::axis3d_front ) );
@@ -140,6 +144,9 @@ PANEL_PREVIEW_3D_MODEL::PANEL_PREVIEW_3D_MODEL( wxWindow* aParent, PCB_BASE_FRAM
this );
}
aFrame->Connect( UNITS_CHANGED, wxCommandEventHandler( PANEL_PREVIEW_3D_MODEL::onUnitsChanged ),
nullptr, this );
#ifdef __WXOSX__
// Call layout once to get the proper button sizes after the bitmaps have been set
Layout();
@@ -538,6 +545,29 @@ void PANEL_PREVIEW_3D_MODEL::onMouseWheelOffset( wxMouseEvent& event )
}
void PANEL_PREVIEW_3D_MODEL::onUnitsChanged( wxCommandEvent& aEvent )
{
double xoff_mm = EDA_UNIT_UTILS::UI::DoubleValueFromString( pcbIUScale, m_userUnits,
xoff->GetValue() )
/ pcbIUScale.IU_PER_MM;
double yoff_mm = EDA_UNIT_UTILS::UI::DoubleValueFromString( pcbIUScale, m_userUnits,
yoff->GetValue() )
/ pcbIUScale.IU_PER_MM;
double zoff_mm = EDA_UNIT_UTILS::UI::DoubleValueFromString( pcbIUScale, m_userUnits,
zoff->GetValue() )
/ pcbIUScale.IU_PER_MM;
PCB_BASE_FRAME* frame = static_cast<PCB_BASE_FRAME*>( aEvent.GetClientData() );
m_userUnits = frame->GetUserUnits();
xoff->SetValue( formatOffsetValue( xoff_mm ) );
yoff->SetValue( formatOffsetValue( yoff_mm ) );
zoff->SetValue( formatOffsetValue( zoff_mm ) );
aEvent.Skip();
}
void PANEL_PREVIEW_3D_MODEL::UpdateDummyFootprint( bool aReloadRequired )
{
m_dummyFootprint->Models().clear();
@@ -141,6 +141,8 @@ private:
void doIncrementRotation( wxSpinEvent& aEvent, double aSign );
void doIncrementOffset( wxSpinEvent& aEvent, double aSign );
void onUnitsChanged( wxCommandEvent& aEvent );
wxString formatScaleValue( double aValue );
wxString formatRotationValue( double aValue );
wxString formatOffsetValue( double aValue );
@@ -183,12 +183,11 @@ PANEL_PREVIEW_3D_MODEL_BASE::PANEL_PREVIEW_3D_MODEL_BASE( wxWindow* parent, wxWi
wxBoxSizer* bSizer6;
bSizer6 = new wxBoxSizer( wxHORIZONTAL );
wxStaticText* staticPreviewLabel;
staticPreviewLabel = new wxStaticText( this, wxID_ANY, _("Preview"), wxDefaultPosition, wxDefaultSize, 0 );
staticPreviewLabel->Wrap( -1 );
staticPreviewLabel->SetFont( wxFont( 11, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxEmptyString ) );
m_previewLabel = new wxStaticText( this, wxID_ANY, _("Preview"), wxDefaultPosition, wxDefaultSize, 0 );
m_previewLabel->Wrap( -1 );
m_previewLabel->SetFont( wxFont( 11, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxEmptyString ) );
bSizer6->Add( staticPreviewLabel, 0, wxEXPAND|wxLEFT|wxRIGHT, 10 );
bSizer6->Add( m_previewLabel, 1, wxEXPAND|wxLEFT|wxRIGHT, 10 );
bSizerRight->Add( bSizer6, 0, wxEXPAND, 5 );
@@ -207,7 +206,7 @@ PANEL_PREVIEW_3D_MODEL_BASE::PANEL_PREVIEW_3D_MODEL_BASE( wxWindow* parent, wxWi
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|wxBOTTOM, 5 );
bSizer3DButtons->Add( m_bpvISO, 0, wxTOP, 14 );
bSizer3DButtons->Add( 0, 0, 1, wxEXPAND, 5 );
@@ -2089,7 +2089,7 @@
<object class="sizeritem" expanded="1">
<property name="border">10</property>
<property name="flag">wxEXPAND|wxLEFT|wxRIGHT</property>
<property name="proportion">0</property>
<property name="proportion">1</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
@@ -2127,11 +2127,11 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">staticPreviewLabel</property>
<property name="name">m_previewLabel</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">none</property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
@@ -2172,8 +2172,8 @@
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxTOP|wxBOTTOM</property>
<property name="border">14</property>
<property name="flag">wxTOP</property>
<property name="proportion">0</property>
<object class="wxBitmapButton" expanded="1">
<property name="BottomDockable">1</property>
@@ -68,6 +68,7 @@ class PANEL_PREVIEW_3D_MODEL_BASE : public wxPanel
wxSlider* m_opacity;
wxTextCtrl* m_boardThicknessCtrl;
wxStaticText* m_boardThicknessUnits;
wxStaticText* m_previewLabel;
wxBoxSizer* m_SizerPanelView;
wxBitmapButton* m_bpvISO;
wxBitmapButton* m_bpvLeft;
+6 -2
View File
@@ -350,12 +350,16 @@ endif(USE_DISTCC)
# Set flags for GCC, or treat llvm as GCC
#================================================
if( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
if( CMAKE_COMPILER_IS_GNUCXX )
# 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_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.
+1 -1
View File
@@ -66,7 +66,7 @@ macro( create_git_version_header _git_src_path )
# Check to make sure 'git' command did not fail. Otherwise fallback
# to KiCadVersion.cmake as the revision level.
if( _git_describe_result EQUAL 0 )
set( KICAD_VERSION "(${_git_DESCRIBE})" )
set( KICAD_VERSION "${_git_DESCRIBE}" )
endif()
if( _git_rev_parse_head_result EQUAL 0 )
+11 -2
View File
@@ -926,8 +926,17 @@ if(wxWidgets_FOUND)
"\\2" wxWidgets_VERSION_MINOR "${_wx_version_h}" )
string(REGEX REPLACE "^(.*\n)?#define +wxRELEASE_NUMBER +([0-9]+).*"
"\\2" wxWidgets_VERSION_PATCH "${_wx_version_h}" )
set(wxWidgets_VERSION_STRING
"${wxWidgets_VERSION_MAJOR}.${wxWidgets_VERSION_MINOR}.${wxWidgets_VERSION_PATCH}" )
string(REGEX REPLACE "^(.*\n)?#define +wxSUBRELEASE_NUMBER +([0-9]+).*"
"\\2" wxWidgets_VERSION_SUBRELEASE "${_wx_version_h}" )
if( ${wxWidgets_VERSION_SUBRELEASE} GREATER 0 )
set(wxWidgets_VERSION_STRING
"${wxWidgets_VERSION_MAJOR}.${wxWidgets_VERSION_MINOR}.${wxWidgets_VERSION_PATCH}.${wxWidgets_VERSION_SUBRELEASE}" )
else()
set(wxWidgets_VERSION_STRING
"${wxWidgets_VERSION_MAJOR}.${wxWidgets_VERSION_MINOR}.${wxWidgets_VERSION_PATCH}" )
endif()
DBG_MSG("wxWidgets_VERSION_STRING: ${wxWidgets_VERSION_STRING}")
endif()
+1 -1
View File
@@ -37,7 +37,7 @@
# KiCad.
#
# Note: This version string should follow the semantic versioning system
set( KICAD_SEMANTIC_VERSION "7.0.0" )
set( KICAD_SEMANTIC_VERSION "7.0.4" )
# Default the version to the semantic version.
# This is overridden by the git repository tag though (if using git)
+3 -6
View File
@@ -620,12 +620,9 @@ target_link_libraries( pcbcommon PUBLIC
threadpool
)
if( KICAD_USE_3DCONNEXION )
message( STATUS "Including 3Dconnexion SpaceMouse navigation support in pcbcommon" )
add_subdirectory( ../pcbnew/navlib ./navlib)
target_link_libraries( pcbcommon PUBLIC pcbnew_navlib)
endif()
message( STATUS "Including 3Dconnexion SpaceMouse navigation support in pcbcommon" )
add_subdirectory( ../pcbnew/navlib ./navlib)
target_link_libraries( pcbcommon PUBLIC pcbnew_navlib)
add_dependencies( pcbcommon delaunator )
+25
View File
@@ -62,6 +62,16 @@ namespace AC_STACK
namespace AC_KEYS
{
/**
* Should the schematic use the new incremental connectivity algorithm
*/
static const wxChar IncrementalConnectivity[] = wxT( "IncrementalConnectivity" );
/**
* Decide whether to attempt usage of the 3DConnexion mouse
*/
static const wxChar Use3DConnexionDriver[] = wxT( "3DConnexionDriver" );
/**
* When filling zones, we add an extra amount of clearance to each zone to ensure that rounding
* errors do not overrun minimum clearance distances. This is the extra in mm.
@@ -321,6 +331,15 @@ ADVANCED_CFG::ADVANCED_CFG()
m_UseClipper2 = true;
#ifdef _WIN32
// spacemouse is largely stable on Windows
m_Use3DConnexionDriver = true;
#else
m_Use3DConnexionDriver = false;
#endif
m_IncrementalConnectivity = false;
loadFromConfigFile();
}
@@ -463,6 +482,12 @@ void ADVANCED_CFG::loadSettings( wxConfigBase& aCfg )
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::UseClipper2,
&m_UseClipper2, m_UseClipper2 ) );
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::Use3DConnexionDriver,
&m_Use3DConnexionDriver, m_Use3DConnexionDriver ) );
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::IncrementalConnectivity,
&m_IncrementalConnectivity, m_IncrementalConnectivity ) );
// Special case for trace mask setting...we just grab them and set them immediately
+1
View File
@@ -45,6 +45,7 @@
#include <eda_base_frame.h>
#include <eda_draw_frame.h>
#include <paths.h>
#include <kiplatform/ui.h>
static std::unique_ptr<BITMAP_STORE> s_BitmapStore;
+55 -15
View File
@@ -41,7 +41,8 @@ BITMAP_BASE::BITMAP_BASE( const VECTOR2I& pos )
m_ppi = 300; // the bitmap definition. the default is 300PPI
m_pixelSizeIu = 254000.0 / m_ppi; // a pixel size value OK for bitmaps using 300 PPI
// for Eeschema which uses currently 254000PPI
m_isMirrored = false;
m_isMirroredX = false;
m_isMirroredY = false;
m_rotation = ANGLE_0;
}
@@ -51,7 +52,8 @@ BITMAP_BASE::BITMAP_BASE( const BITMAP_BASE& aSchBitmap )
m_scale = aSchBitmap.m_scale;
m_ppi = aSchBitmap.m_ppi;
m_pixelSizeIu = aSchBitmap.m_pixelSizeIu;
m_isMirrored = aSchBitmap.m_isMirrored;
m_isMirroredX = aSchBitmap.m_isMirroredX;
m_isMirroredY = aSchBitmap.m_isMirroredY;
m_rotation = aSchBitmap.m_rotation;
m_image = nullptr;
@@ -75,6 +77,7 @@ void BITMAP_BASE::SetImage( wxImage* aImage )
delete m_originalImage;
m_originalImage = new wxImage( *aImage );
rebuildBitmap();
updatePPI();
}
@@ -90,6 +93,21 @@ void BITMAP_BASE::rebuildBitmap( bool aResetID )
}
void BITMAP_BASE::updatePPI()
{
// Todo: eventually we need to support dpi / scaling in both dimensions
int dpiX = m_originalImage->GetOptionInt( wxIMAGE_OPTION_RESOLUTIONX );
if( dpiX > 1 )
{
if( m_originalImage->GetOptionInt( wxIMAGE_OPTION_RESOLUTIONUNIT ) == wxIMAGE_RESOLUTION_CM )
m_ppi = KiROUND( dpiX * 2.54 );
else
m_ppi = dpiX;
}
}
void BITMAP_BASE::ImportData( BITMAP_BASE* aItem )
{
*m_image = *aItem->m_image;
@@ -99,7 +117,8 @@ void BITMAP_BASE::ImportData( BITMAP_BASE* aItem )
m_scale = aItem->m_scale;
m_ppi = aItem->m_ppi;
m_pixelSizeIu = aItem->m_pixelSizeIu;
m_isMirrored = aItem->m_isMirrored;
m_isMirroredX = aItem->m_isMirroredX;
m_isMirroredY = aItem->m_isMirroredY;
m_rotation = aItem->m_rotation;
}
@@ -116,6 +135,7 @@ bool BITMAP_BASE::ReadImageFile( wxInputStream& aInStream )
delete m_originalImage;
m_originalImage = new wxImage( *m_image );
rebuildBitmap();
updatePPI();
return true;
}
@@ -136,17 +156,7 @@ bool BITMAP_BASE::ReadImageFile( const wxString& aFullFilename )
delete m_originalImage;
m_originalImage = new wxImage( *m_image );
rebuildBitmap();
// Todo: eventually we need to support dpi / scaling in both dimensions
int dpiX = m_originalImage->GetOptionInt( wxIMAGE_OPTION_RESOLUTIONX );
if( dpiX > 1 )
{
if( m_originalImage->GetOptionInt( wxIMAGE_OPTION_RESOLUTIONUNIT ) == wxIMAGE_RESOLUTION_CM )
m_ppi = KiROUND( dpiX * 2.54 );
else
m_ppi = dpiX;
}
updatePPI();
return true;
}
@@ -393,8 +403,25 @@ void BITMAP_BASE::Mirror( bool aVertically )
{
if( m_image )
{
// wxImage::Mirror() clear some parameters of the original image.
// We need to restore them, especially resolution and unit, to be
// sure image parameters saved in file are the right parameters, not
// the defualt values
int resX = m_image->GetOptionInt( wxIMAGE_OPTION_RESOLUTIONX );
int resY = m_image->GetOptionInt( wxIMAGE_OPTION_RESOLUTIONY );
int unit = m_image->GetOptionInt( wxIMAGE_OPTION_RESOLUTIONUNIT );
*m_image = m_image->Mirror( not aVertically );
m_isMirrored = !m_isMirrored;
m_image->SetOption( wxIMAGE_OPTION_RESOLUTIONUNIT , unit);
m_image->SetOption( wxIMAGE_OPTION_RESOLUTIONX, resX);
m_image->SetOption( wxIMAGE_OPTION_RESOLUTIONY, resY);
if( aVertically )
m_isMirroredY = !m_isMirroredY;
else
m_isMirroredX = !m_isMirroredX;
rebuildBitmap( false );
}
}
@@ -404,7 +431,20 @@ void BITMAP_BASE::Rotate( bool aRotateCCW )
{
if( m_image )
{
// wxImage::Rotate90() clear some parameters of the original image.
// We need to restore them, especially resolution and unit, to be
// sure image parameters saved in file are the right parameters, not
// the defualt values
int resX = m_image->GetOptionInt( wxIMAGE_OPTION_RESOLUTIONX );
int resY = m_image->GetOptionInt( wxIMAGE_OPTION_RESOLUTIONY );
int unit = m_image->GetOptionInt( wxIMAGE_OPTION_RESOLUTIONUNIT );
*m_image = m_image->Rotate90( aRotateCCW );
m_image->SetOption( wxIMAGE_OPTION_RESOLUTIONUNIT , unit);
m_image->SetOption( wxIMAGE_OPTION_RESOLUTIONX, resX);
m_image->SetOption( wxIMAGE_OPTION_RESOLUTIONY, resY);
m_rotation += ( aRotateCCW ? -ANGLE_90 : ANGLE_90 );
rebuildBitmap( false );
}
+12 -4
View File
@@ -177,12 +177,20 @@ wxString GetVersionInfoData( const wxString& aTitle, bool aHtml, bool aBrief )
aMsg << eol;
aMsg << "Platform: "
wxString osDescription;
#if __LINUX__
<< wxGetLinuxDistributionInfo().Description << ", "
#else
<< wxGetOsDescription() << ", "
osDescription = wxGetLinuxDistributionInfo().Description;
#endif
// Linux uses the lsb-release program to get the description of the OS, if lsb-release
// isn't installed, then the string will be empty and we fallback to the method used on
// the other platforms (to at least get the kernel/uname info).
if( osDescription.empty() )
osDescription = wxGetOsDescription();
aMsg << "Platform: "
<< osDescription << ", "
<< GetPlatformGetBitnessName() << ", "
<< platform.GetEndiannessName() << ", "
<< platform.GetPortIdName();
+4 -21
View File
@@ -31,30 +31,13 @@
#include <dialogs/html_message_box.h>
#include <functional>
#include <unordered_map>
#include <pgm_base.h>
#include "cli/cli_names.h"
// Set of dialogs that have been chosen not to be shown again
static std::unordered_map<unsigned long, int> doNotShowAgainDlgs;
bool IsGUI()
{
if( !wxTheApp )
return false;
#if wxCHECK_VERSION( 3, 1, 6 )
return wxTheApp->IsGUI();
#else
// wxWidgets older than version 3.1.6 do not have a way to know if the app
// has a GUI or is a console application.
// So the trick is to set the App class name when starting kicad-cli, and when
// the app class name is the kicad-cli class name the app is a console app
bool run_gui = wxTheApp->GetClassName() != KICAD_CLI_APP_NAME;
return run_gui;
#endif
}
KIDIALOG::KIDIALOG( wxWindow* aParent, const wxString& aMessage, const wxString& aCaption,
long aStyle )
: wxRichMessageDialog( aParent, aMessage, aCaption, aStyle | wxCENTRE | wxSTAY_ON_TOP ),
@@ -305,7 +288,7 @@ void DisplayError( wxWindow* aParent, const wxString& aText, int aDisplayTime )
return;
}
if( !IsGUI() )
if( !Pgm().IsGUI() )
{
wxFprintf( stderr, aText );
return;
@@ -330,7 +313,7 @@ void DisplayErrorMessage( wxWindow* aParent, const wxString& aText, const wxStri
return;
}
if( !IsGUI() )
if( !Pgm().IsGUI() )
{
wxFprintf( stderr, aText );
return;
@@ -357,7 +340,7 @@ void DisplayInfoMessage( wxWindow* aParent, const wxString& aMessage, const wxSt
return;
}
if( !IsGUI() )
if( !Pgm().IsGUI() )
{
wxFprintf( stdout, "%s %s", aMessage, aExtraInfo );
return;
+10 -2
View File
@@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2022 Jon Evans <jon@craftyjon.com>
* Copyright (C) 2022 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2022-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
@@ -178,7 +178,15 @@ bool DATABASE_CONNECTION::Disconnect()
return false;
}
m_conn->disconnect();
try
{
m_conn->disconnect();
}
catch( boost::locale::conv::conversion_error& exc )
{
wxLogTrace( traceDatabase, wxT( "Disconnect() error \"%s\" occured." ), exc.what() );
return false;
}
return !m_conn->connected();
}
+53 -1
View File
@@ -659,6 +659,10 @@ static void buildKicadAboutBanner( EDA_BASE_FRAME* aParent, ABOUT_APP_INFO& aInf
wxEmptyString,
wxEmptyString,
wxS( "Greek (el_GR)" ) ) );
aInfo.AddTranslator( new CONTRIBUTOR( wxS( "aris-kimi" ),
wxEmptyString,
wxEmptyString,
wxS( "Greek (el_GR)" ) ) );
aInfo.AddTranslator( new CONTRIBUTOR( wxT( "Adolfo Jayme Barrientos" ),
wxEmptyString,
@@ -688,6 +692,10 @@ static void buildKicadAboutBanner( EDA_BASE_FRAME* aParent, ABOUT_APP_INFO& aInf
wxEmptyString,
wxEmptyString,
wxS( "Spanish (ES)" ) ) );
aInfo.AddTranslator( new CONTRIBUTOR( wxT( "VicSanRoPe" ),
wxEmptyString,
wxEmptyString,
wxS( "Spanish - Latin American (ES)" ) ) );
aInfo.AddTranslator( new CONTRIBUTOR( wxT( "Ulices Avila Hernandez" ),
wxEmptyString,
@@ -822,14 +830,46 @@ static void buildKicadAboutBanner( EDA_BASE_FRAME* aParent, ABOUT_APP_INFO& aInf
wxEmptyString,
wxEmptyString,
wxS( "Korean (KO)" ) ) );
aInfo.AddTranslator( new CONTRIBUTOR( wxT( "김낙환" ),
wxEmptyString,
wxEmptyString,
wxS( "Korean (KO)" ) ) );
aInfo.AddTranslator( new CONTRIBUTOR( wxT( "이기형" ),
wxEmptyString,
wxEmptyString,
wxS( "Korean (KO)" ) ) );
aInfo.AddTranslator( new CONTRIBUTOR( wxT( "남우근" ),
wxEmptyString,
wxEmptyString,
wxS( "Korean (KO)" ) ) );
aInfo.AddTranslator( new CONTRIBUTOR( wxT( "강명구" ),
wxEmptyString,
wxEmptyString,
wxS( "Korean (KO)" ) ) );
aInfo.AddTranslator( new CONTRIBUTOR( wxT( "김용재" ),
wxEmptyString,
wxEmptyString,
wxS( "Korean (KO)" ) ) );
aInfo.AddTranslator( new CONTRIBUTOR( wxT( "서범기" ),
wxEmptyString,
wxEmptyString,
wxS( "Korean (KO)" ) ) );
aInfo.AddTranslator( new CONTRIBUTOR( wxT( "김세영" ),
wxEmptyString,
wxEmptyString,
wxS( "Korean (KO)" ) ) );
aInfo.AddTranslator( new CONTRIBUTOR( wxT( "이윤성" ),
wxEmptyString,
wxEmptyString,
wxS( "Korean (KO)" ) ) );
aInfo.AddTranslator( new CONTRIBUTOR( wxT( "KwonHyeokbeom" ),
wxEmptyString,
wxEmptyString,
wxS( "Korean (KO)" ) ) );
aInfo.AddTranslator( new CONTRIBUTOR( wxT( "Minsu Kim (0xGabriel)" ),
wxEmptyString,
wxEmptyString,
wxS( "Korean (KO)" ) ) );
aInfo.AddTranslator( new CONTRIBUTOR( wxT( "Henrik Kauhanen" ),
wxEmptyString,
@@ -860,6 +900,14 @@ static void buildKicadAboutBanner( EDA_BASE_FRAME* aParent, ABOUT_APP_INFO& aInf
wxEmptyString,
wxEmptyString,
wxS( "Dutch (NL)" ) ) );
aInfo.AddTranslator( new CONTRIBUTOR( wxT( "Tom Niesse" ),
wxEmptyString,
wxEmptyString,
wxS( "Dutch (NL)" ) ) );
aInfo.AddTranslator( new CONTRIBUTOR( wxT( "Christiaan Nieuwlaat" ),
wxEmptyString,
wxEmptyString,
wxS( "Dutch (NL)" ) ) );
aInfo.AddTranslator( new CONTRIBUTOR( wxT( "Jarl Gjessing" ),
wxEmptyString,
@@ -932,6 +980,10 @@ static void buildKicadAboutBanner( EDA_BASE_FRAME* aParent, ABOUT_APP_INFO& aInf
wxEmptyString,
wxEmptyString,
wxS( "Portuguese (PT)" ) ) );
aInfo.AddTranslator( new CONTRIBUTOR( wxT( "ssantos" ),
wxEmptyString,
wxEmptyString,
wxS( "Portuguese (PT)" ) ) );
aInfo.AddTranslator( new CONTRIBUTOR( wxT( "Igor Plyatov" ),
wxEmptyString,
@@ -1129,7 +1181,7 @@ static void buildKicadAboutBanner( EDA_BASE_FRAME* aParent, ABOUT_APP_INFO& aInf
#define SYMBOL_LIB_CONTRIBUTION _( "Symbols by" )
aInfo.AddLibrarian( new CONTRIBUTOR( wxS( "GitLab contributors" ),
wxEmptyString,
wxS( "https://gitlab.com/kicad/libraries/kicad-symbols/-/graphs/v7" ),
wxS( "https://gitlab.com/kicad/libraries/kicad-symbols/-/graphs/master" ),
SYMBOL_LIB_CONTRIBUTION,
aInfo.CreateKiBitmap( BITMAPS::add_component ) ) );
+54 -31
View File
@@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2012-2022 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2012-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
@@ -67,10 +67,6 @@ public:
BEGIN_EVENT_TABLE( DIALOG_SHIM, wxDialog )
// If dialog has a grid and the grid has an active cell editor
// Esc key closes cell editor, otherwise Esc key closes the dialog.
EVT_GRID_EDITOR_SHOWN( DIALOG_SHIM::OnGridEditorShown )
EVT_GRID_EDITOR_HIDDEN( DIALOG_SHIM::OnGridEditorHidden )
EVT_CHAR_HOOK( DIALOG_SHIM::OnCharHook )
END_EVENT_TABLE()
@@ -325,30 +321,38 @@ bool DIALOG_SHIM::Enable( bool enable )
// Recursive descent doing a SelectAll() in wxTextCtrls.
// MacOS User Interface Guidelines state that when tabbing to a text control all its
// text should be selected. Since wxWidgets fails to implement this, we do it here.
static void selectAllInTextCtrls( wxWindowList& children )
void DIALOG_SHIM::selectAllInTextCtrls( wxWindowList& children )
{
for( wxWindow* child : children )
{
if( wxTextCtrl* childTextCtrl = dynamic_cast<wxTextCtrl*>( child ) )
if( wxTextCtrl* textCtrl = dynamic_cast<wxTextCtrl*>( child ) )
{
m_beforeEditValues[ textCtrl ] = textCtrl->GetValue();
textCtrl->Connect( wxEVT_SET_FOCUS, wxFocusEventHandler( DIALOG_SHIM::onChildSetFocus ),
nullptr, this );
// We don't currently run this on GTK because some window managers don't hide the
// selection in non-active controls, and other window managers do the selection
// automatically anyway.
#if defined( __WXMAC__ ) || defined( __WXMSW__ )
if( !childTextCtrl->GetStringSelection().IsEmpty() )
if( !textCtrl->GetStringSelection().IsEmpty() )
{
// Respect an existing selection
}
else
else if( textCtrl->IsEditable() )
{
childTextCtrl->SelectAll();
textCtrl->SelectAll();
}
#else
ignore_unused( childTextCtrl );
ignore_unused( textCtrl );
#endif
}
else if( wxStyledTextCtrl* scintilla = dynamic_cast<wxStyledTextCtrl*>( child ) )
{
m_beforeEditValues[ scintilla ] = scintilla->GetText();
scintilla->Connect( wxEVT_SET_FOCUS, wxFocusEventHandler( DIALOG_SHIM::onChildSetFocus ),
nullptr, this );
if( !scintilla->GetSelectedText().IsEmpty() )
{
// Respect an existing selection
@@ -533,11 +537,6 @@ void DIALOG_SHIM::OnButton( wxCommandEvent& aEvent )
{
const int id = aEvent.GetId();
// If we are pressing a button to exit, we need to enable the escapeID
// otherwise the dialog does not process cancel
if( id == wxID_CANCEL )
SetEscapeId( wxID_ANY );
if( IsQuasiModal() )
{
if( id == GetAffirmativeId() )
@@ -555,7 +554,7 @@ void DIALOG_SHIM::OnButton( wxCommandEvent& aEvent )
ignore_unused( TransferDataFromWindow() );
}
}
else if( id == GetEscapeId() || (id == wxID_CANCEL && GetEscapeId() == wxID_ANY) )
else if( id == wxID_CANCEL )
{
EndQuasiModal( wxID_CANCEL );
}
@@ -572,6 +571,19 @@ void DIALOG_SHIM::OnButton( wxCommandEvent& aEvent )
}
void DIALOG_SHIM::onChildSetFocus( wxFocusEvent& aEvent )
{
// When setting focus to a text control reset the before-edit value.
if( wxTextCtrl* textCtrl = dynamic_cast<wxTextCtrl*>( aEvent.GetEventObject() ) )
m_beforeEditValues[ textCtrl ] = textCtrl->GetValue();
else if( wxStyledTextCtrl* scintilla = dynamic_cast<wxStyledTextCtrl*>( aEvent.GetEventObject() ) )
m_beforeEditValues[ scintilla ] = scintilla->GetText();
aEvent.Skip();
}
void DIALOG_SHIM::OnCharHook( wxKeyEvent& aEvt )
{
if( aEvt.GetKeyCode() == 'U' && aEvt.GetModifiers() == wxMOD_CONTROL )
@@ -626,25 +638,36 @@ void DIALOG_SHIM::OnCharHook( wxKeyEvent& aEvt )
return;
}
}
else if( aEvt.GetKeyCode() == WXK_ESCAPE )
{
wxObject* eventSource = aEvt.GetEventObject();
if( wxTextCtrl* textCtrl = dynamic_cast<wxTextCtrl*>( eventSource ) )
{
// First escape after an edit cancels edit
if( textCtrl->GetValue() != m_beforeEditValues[ textCtrl ] )
{
textCtrl->SetValue( m_beforeEditValues[ textCtrl ] );
textCtrl->SelectAll();
return;
}
}
else if( wxStyledTextCtrl* scintilla = dynamic_cast<wxStyledTextCtrl*>( eventSource ) )
{
// First escape after an edit cancels edit
if( scintilla->GetText() != m_beforeEditValues[ scintilla ] )
{
scintilla->SetText( m_beforeEditValues[ scintilla ] );
scintilla->SelectAll();
return;
}
}
}
aEvt.Skip();
}
void DIALOG_SHIM::OnGridEditorShown( wxGridEvent& event )
{
SetEscapeId( wxID_NONE );
event.Skip();
}
void DIALOG_SHIM::OnGridEditorHidden( wxGridEvent& event )
{
SetEscapeId( wxID_ANY );
event.Skip();
}
static void recursiveDescent( wxSizer* aSizer, std::map<int, wxString>& aLabels )
{
wxStdDialogButtonSizer* sdbSizer = dynamic_cast<wxStdDialogButtonSizer*>( aSizer );
+2 -5
View File
@@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2022 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2022-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
@@ -105,10 +105,7 @@ void DIALOG_ASSIGN_NETCLASS::onPatternText( wxCommandEvent& aEvent )
for( const wxString& net : m_netCandidates )
{
int matches;
int offset;
if( matcher.Find( net, matches, offset ) && offset == 0 )
if( matcher.StartsWith( net ) )
{
m_matchingNets->Report( net );
matchingNetNames.push_back( net );
+12 -10
View File
@@ -396,12 +396,12 @@ void DIALOG_COLOR_PICKER::drawRGBPalette()
// Use Y axis from bottom to top and origin to center
bitmapDC.SetAxisOrientation( true, true );
#if wxCHECK_VERSION( 3, 1, 7 )
#if wxCHECK_VERSION( 3, 1, 7 ) && defined( __WXMSW__)
// For some reason, SetDeviceOrigin has changed in wxWidgets 3.1.6 or 3.1.7
bitmapDC.SetDeviceOrigin( half_size, -half_size );
#else
#else
bitmapDC.SetDeviceOrigin( half_size, half_size );
#endif
#endif
// Reserve room to draw cursors inside the bitmap
half_size -= m_cursorsSize/2;
@@ -466,12 +466,12 @@ void DIALOG_COLOR_PICKER::drawHSVPalette()
// Use Y axis from bottom to top and origin to center
bitmapDC.SetAxisOrientation( true, true );
#if wxCHECK_VERSION( 3, 1, 7 )
#if wxCHECK_VERSION( 3, 1, 7 ) && defined( __WXMSW__)
// For some reason, SetDeviceOrigin has changed in wxWidgets 3.1.6 or 3.1.7
bitmapDC.SetDeviceOrigin( half_size, -half_size );
#else
#else
bitmapDC.SetDeviceOrigin( half_size, half_size );
#endif
#endif
// Reserve room to draw cursors inside the bitmap
half_size -= m_cursorsSize / 2;
@@ -701,11 +701,13 @@ void DIALOG_COLOR_PICKER::onHSVMouseDrag( wxMouseEvent& event )
void DIALOG_COLOR_PICKER::OnColorValueText( wxCommandEvent& event )
{
m_newColor4D.SetFromHexString( m_colorValue->GetValue() );
m_newColor4D.ToHSV( m_hue, m_sat, m_val, true );
if( m_newColor4D.SetFromHexString( m_colorValue->GetValue() ) )
{
m_newColor4D.ToHSV( m_hue, m_sat, m_val, true );
SetEditVals( HEX_CHANGED, true );
drawAll();
SetEditVals( HEX_CHANGED, false );
drawAll();
}
}
+4 -4
View File
@@ -223,7 +223,7 @@ bool DIALOG_PAGES_SETTINGS::TransferDataFromWindow()
m_screen->SetContentModified();
if( LocalPrjConfigChanged() )
m_parent->SaveProjectSettings();
m_parent->OnModify();
// Call the post processing (if any) after changes
m_parent->OnPageSettingsChange();
@@ -674,9 +674,9 @@ void DIALOG_PAGES_SETTINGS::UpdateDrawingSheetExample()
GRFilledRect( &memDC, VECTOR2I( 0, 0 ), m_layout_size, 0, bgColor, bgColor );
PrintDrawingSheet( &renderSettings, pageDUMMY, emptyString, emptyString, m_tb,
nullptr, m_screen->GetPageCount(), m_screen->GetPageNumber(), 1,
&Prj(), wxEmptyString, m_screen->GetVirtualPageNumber() == 1 );
PrintDrawingSheet( &renderSettings, pageDUMMY, emptyString, emptyString, emptyString,
m_tb, nullptr, m_screen->GetPageCount(), m_screen->GetPageNumber(),
1, &Prj(), wxEmptyString, m_screen->GetVirtualPageNumber() == 1 );
memDC.SelectObject( wxNullBitmap );
m_PageLayoutExampleBitmap->SetBitmap( *m_pageBitmap );
+19 -7
View File
@@ -117,8 +117,7 @@ void PANEL_COLOR_SETTINGS::OnThemeChanged( wxCommandEvent& event )
if( idx == static_cast<int>( m_cbTheme->GetCount() ) - 2 )
{
// separator; re-select active theme
m_cbTheme->SetStringSelection( m_currentSettings->GetName() );
m_cbTheme->SetStringSelection( GetSettingsDropdownName( m_currentSettings ) );
return;
}
@@ -217,10 +216,7 @@ void PANEL_COLOR_SETTINGS::createThemeList( const wxString& aCurrent )
for( COLOR_SETTINGS* settings : Pgm().GetSettingsManager().GetColorSettingsList() )
{
wxString name = settings->GetName();
if( settings->IsReadOnly() )
name += wxS( " " ) + _( "(read-only)" );
wxString name = GetSettingsDropdownName( settings );
int pos = m_cbTheme->Append( name, static_cast<void*>( settings ) );
@@ -262,8 +258,11 @@ void PANEL_COLOR_SETTINGS::createSwatch( int aLayer, const wxString& aName )
defaultColor, SWATCH_MEDIUM );
swatch->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) );
m_colorsGridSizer->Add( label, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT | wxLEFT, 5 );
// Display the swatches in the left column and the layer name in the right column
// The right column is sometimes (depending on the translation) truncated for long texts.
// We cannot allow swatches to be truncated or not shown
m_colorsGridSizer->Add( swatch, 0, wxALIGN_CENTER_VERTICAL | wxALL, 3 );
m_colorsGridSizer->Add( label, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT | wxLEFT, 5 );
m_labels[aLayer] = label;
m_swatches[aLayer] = swatch;
@@ -283,6 +282,8 @@ void PANEL_COLOR_SETTINGS::ShowColorContextMenu( wxMouseEvent& aEvent, int aLaye
auto selected =
static_cast<COLOR_SETTINGS*>( m_cbTheme->GetClientData( m_cbTheme->GetSelection() ) );
wxCHECK_RET( selected, wxT( "Invalid color theme selected" ) );
COLOR4D current = m_currentSettings->GetColor( aLayer );
COLOR4D saved = selected->GetColor( aLayer );
bool readOnly = m_currentSettings->IsReadOnly();
@@ -376,3 +377,14 @@ bool PANEL_COLOR_SETTINGS::saveCurrentTheme( bool aValidate )
return true;
}
wxString PANEL_COLOR_SETTINGS::GetSettingsDropdownName(COLOR_SETTINGS* aSettings)
{
wxString name = aSettings->GetName();
if( aSettings->IsReadOnly() )
name += wxS( " " ) + _( "(read-only)" );
return name;
}
+13 -6
View File
@@ -2,7 +2,7 @@
* This program source code file is part of KICAD, a free EDA CAD application.
*
* Copyright (C) 2018 jean-pierre.charras
* Copyright (C) 2011-2020 Kicad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2011-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
@@ -110,12 +110,19 @@ bool PANEL_IMAGE_EDITOR::TransferDataFromWindow()
void PANEL_IMAGE_EDITOR::OnRedrawPanel( wxPaintEvent& event )
{
wxPaintDC dc( m_panelDraw );
wxSize size = m_panelDraw->GetClientSize();
dc.SetDeviceOrigin( size.x / 2, size.y / 2 );
wxSize display_size = m_panelDraw->GetClientSize();
double scale = 1.0 / m_workingImage->GetScalingFactor();
dc.SetUserScale( scale, scale );
m_workingImage->DrawBitmap( &dc, wxPoint( 0, 0 ) );
double img_scale = 1.0 / m_workingImage->GetScalingFactor();
VECTOR2I img_size_pixels = m_workingImage->GetSizePixels();
// Adjust the display scale to use the full available display area
double scale_X = (double)display_size.x/img_size_pixels.x;
double scale_Y = (double)display_size.y/img_size_pixels.y;
double display_scale = img_scale * std::min( scale_X, scale_Y );
dc.SetUserScale( display_scale, display_scale );
m_workingImage->DrawBitmap( &dc, VECTOR2I( m_workingImage->GetSize()/2 ) );
}
+1 -1
View File
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-133-g388db8e4)
// C++ code generated with wxFormBuilder (version 3.10.1-282-g1fa54006)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
+368
View File
@@ -0,0 +1,368 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project>
<FileVersion major="1" minor="16" />
<object class="Project" expanded="1">
<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">panel_image_editor_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">panel_image_editor_base</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="1">
<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"></property>
<property name="name">PANEL_IMAGE_EDITOR_BASE</property>
<property name="pos"></property>
<property name="size">500,300</property>
<property name="subclass">; ; 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>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizerMain</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bUpperSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizerLeft</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND | wxALL</property>
<property name="proportion">1</property>
<object class="wxPanel" 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="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">256,256</property>
<property name="moveable">1</property>
<property name="name">m_panelDraw</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"></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">wxFULL_REPAINT_ON_RESIZE|wxTAB_TRAVERSAL|wxBORDER_SIMPLE</property>
<event name="OnPaint">OnRedrawPanel</event>
</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="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizerRight</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxButton" 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">Grey</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_buttonGrey</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"></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>
<event name="OnButtonClick">OnGreyScaleConvert</event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">10</property>
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM</property>
<property name="proportion">0</property>
<object class="spacer" expanded="1">
<property name="height">0</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="flag">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="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">Image Scale:</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_staticTextScale</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="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">wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxTextCtrl" 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="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="maxlength">0</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_textCtrlScale</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="value"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
</wxFormBuilder_Project>
+1 -1
View File
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-133-g388db8e4)
// C++ code generated with wxFormBuilder (version 3.10.1-282-g1fa54006)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
+1 -4
View File
@@ -708,10 +708,7 @@ void PANEL_SETUP_NETCLASSES::OnUpdateUI( wxUpdateUIEvent& event )
for( const wxString& net : m_netNames )
{
int matches;
int offset;
if( matcher.Find( net, matches, offset ) && offset == 0 )
if( matcher.StartsWith( net ) )
m_matchingNets->Report( net );
}
}
+10 -11
View File
@@ -58,7 +58,13 @@ EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWin
const wxPoint& aPosition, const wxSize& aSize,
KIGFX::GAL_DISPLAY_OPTIONS& aOptions, GAL_TYPE aGalType ) :
wxScrolledCanvas( aParentWindow, aWindowId, aPosition, aSize ),
m_MouseCapturedLost( false ),
m_parent( aParentWindow ),
m_edaFrame( nullptr ),
m_lastRefresh( 0 ),
m_pendingRefresh( false ),
m_drawing( false ),
m_drawingEnabled( false ),
m_gal( nullptr ),
m_view( nullptr ),
m_painter( nullptr ),
@@ -70,11 +76,10 @@ EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWin
m_stealsFocus( true ),
m_statusPopup( nullptr )
{
m_parent = aParentWindow;
m_MouseCapturedLost = false;
m_PaintEventCounter = std::make_unique<PROF_COUNTER>( "Draw panel paint events" );
m_minRefreshPeriod = 13; // 77 FPS (minus render time) by default
SetLayoutDirection( wxLayout_LeftToRight );
m_edaFrame = dynamic_cast<EDA_DRAW_FRAME*>( m_parent );
@@ -146,12 +151,6 @@ EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWin
Connect( eventType, wxEventHandler( EDA_DRAW_PANEL_GAL::OnEvent ), nullptr,
m_eventDispatcher );
m_pendingRefresh = false;
m_drawing = false;
m_drawingEnabled = false;
m_minRefreshPeriod = 13; // 77 FPS (minus render time) by default
// Set up timer that prevents too frequent redraw commands
m_refreshTimer.SetOwner( this );
Connect( m_refreshTimer.GetId(), wxEVT_TIMER,
@@ -212,7 +211,7 @@ void EDA_DRAW_PANEL_GAL::DoRePaint()
if( !m_drawingEnabled )
return;
if( !m_gal->IsVisible() )
if( !m_gal->IsInitialized() || !m_gal->IsVisible() )
return;
m_pendingRefresh = false;
@@ -627,7 +626,7 @@ void EDA_DRAW_PANEL_GAL::onRefreshTimer( wxTimerEvent& aEvent )
void EDA_DRAW_PANEL_GAL::onShowTimer( wxTimerEvent& aEvent )
{
if( m_gal && m_gal->IsVisible() )
if( m_gal && m_gal->IsInitialized() && m_gal->IsVisible() )
{
m_onShowTimer.Stop();
OnShow();
+7 -3
View File
@@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2013 Jean-Pierre Charras <jp.charras at wanadoo.fr>.
* Copyright (C) 1992-2022 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
@@ -118,8 +118,12 @@ void DS_DRAW_ITEM_BASE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame,
break;
case DS_DATA_ITEM::DS_TEXT:
aList.emplace_back( _( "Text" ), static_cast<DS_DRAW_ITEM_TEXT*>( this )->GetShownText() );
{
DS_DRAW_ITEM_TEXT* textItem = static_cast<DS_DRAW_ITEM_TEXT*>( this );
// Don't use GetShownText(); we want to see the variable references here
aList.emplace_back( _( "Text" ), KIUI::EllipsizeStatusText( aFrame, textItem->GetText() ) );
break;
}
case DS_DATA_ITEM::DS_POLYPOLYGON:
aList.emplace_back( _( "Imported Shape" ), wxEmptyString );
@@ -190,7 +194,7 @@ bool DS_DRAW_ITEM_TEXT::HitTest( const BOX2I& aRect, bool aContains, int aAccura
wxString DS_DRAW_ITEM_TEXT::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const
{
return wxString::Format( _( "Text '%s'" ), GetShownText() );
return wxString::Format( _( "Text '%s'" ), KIUI::EllipsizeMenuText( GetText() ) );
}
+1 -1
View File
@@ -270,7 +270,7 @@ void KIGFX::DS_PAINTER::draw( const DS_DRAW_ITEM_TEXT* aItem, int aLayer ) const
attrs.m_StrokeWidth = std::max( aItem->GetEffectiveTextPenWidth(),
m_renderSettings.GetDefaultPenWidth() );
font->Draw( m_gal, aItem->GetShownText(), aItem->GetTextPos(), attrs );
font->Draw( m_gal, aItem->GetShownText( true ), aItem->GetTextPos(), attrs );
}
+8 -1
View File
@@ -55,6 +55,7 @@
#include <widgets/paged_dialog.h>
#include <widgets/wx_infobar.h>
#include <widgets/wx_aui_art_providers.h>
#include <widgets/wx_grid.h>
#include <wx/app.h>
#include <wx/config.h>
#include <wx/display.h>
@@ -219,6 +220,10 @@ void EDA_BASE_FRAME::windowClosing( wxCloseEvent& event )
if( canCloseWindow( event ) )
{
m_isClosing = true;
if( m_infoBar )
m_infoBar->Dismiss();
APP_SETTINGS_BASE* cfg = config();
if( cfg )
@@ -399,6 +404,8 @@ void EDA_BASE_FRAME::HandleUpdateUIEvent( wxUpdateUIEvent& aEvent, EDA_BASE_FRAM
enableRes = true;
else if( textEntry && isPaste && textEntry->CanPaste() )
enableRes = true;
else if( dynamic_cast<WX_GRID*>( focus ) )
enableRes = false; // Must disable menu in order to get command as CharHook event
}
aEvent.Enable( enableRes );
@@ -1230,7 +1237,7 @@ bool EDA_BASE_FRAME::IsWritable( const wxFileName& aFileName, bool aVerbose )
void EDA_BASE_FRAME::CheckForAutoSaveFile( const wxFileName& aFileName )
{
if( !IsGUI() )
if( !Pgm().IsGUI() )
return;
wxCHECK_RET( aFileName.IsOk(), wxT( "Invalid file name!" ) );
+4
View File
@@ -144,6 +144,10 @@ bool GetAssociatedDocument( wxWindow* aParent, const wxString& aDocName, PROJECT
wxFileName currentFileName( fullfilename );
// Use wxWidgets to resolve any "." and ".." in the path
currentFileName.MakeAbsolute();
fullfilename = currentFileName.GetFullPath();
wxString file_ext = currentFileName.GetExt();
if( file_ext.Lower() == wxT( "pdf" ) )
+43 -42
View File
@@ -3,7 +3,7 @@
*
* Copyright (C) 2004-2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 2004-2022 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2004-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
@@ -27,6 +27,7 @@
#include <bitmaps.h>
#include <confirm.h>
#include <core/arraydim.h>
#include <core/kicad_algo.h>
#include <dialog_shim.h>
#include <eda_draw_frame.h>
#include <file_history.h>
@@ -78,12 +79,16 @@ BEGIN_EVENT_TABLE( EDA_DRAW_FRAME, KIWAY_PLAYER )
EVT_ACTIVATE( EDA_DRAW_FRAME::onActivate )
END_EVENT_TABLE()
bool EDA_DRAW_FRAME::m_openGLFailureOccured = false;
EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType,
const wxString& aTitle, const wxPoint& aPos, const wxSize& aSize,
long aStyle, const wxString& aFrameName, const EDA_IU_SCALE& aIuScale ) :
KIWAY_PLAYER( aKiway, aParent, aFrameType, aTitle, aPos, aSize, aStyle, aFrameName, aIuScale )
long aStyle, const wxString& aFrameName,
const EDA_IU_SCALE& aIuScale ) :
KIWAY_PLAYER( aKiway, aParent, aFrameType, aTitle, aPos, aSize, aStyle, aFrameName, aIuScale ),
m_socketServer( nullptr )
{
m_socketServer = nullptr;
m_mainToolBar = nullptr;
@@ -171,8 +176,8 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame
OnMove( dummy );
// we need to kludge the msg panel to the correct size again
// especially important even for first launches as the constructor of the window here usually doesn't
// have the correct dpi awareness yet
// especially important even for first launches as the constructor of the window
// here usually doesn't have the correct dpi awareness yet
m_frameSize.y += m_msgFrameHeight;
m_msgFrameHeight = EDA_MSG_PANEL::GetRequiredHeight( this );
m_frameSize.y -= m_msgFrameHeight;
@@ -285,7 +290,7 @@ void EDA_DRAW_FRAME::ToggleUserUnits()
else
{
SetUserUnits( GetUserUnits() == EDA_UNITS::INCHES ? EDA_UNITS::MILLIMETRES
: EDA_UNITS::INCHES );
: EDA_UNITS::INCHES );
unitsChangeRefresh();
wxCommandEvent e( UNITS_CHANGED );
@@ -609,7 +614,8 @@ void EDA_DRAW_FRAME::DisplayGridMsg()
{
wxString msg;
msg.Printf( wxS( "grid %s" ), MessageTextFromValue( GetCanvas()->GetGAL()->GetGridSize().x, false ) );
msg.Printf( _( "grid %s" ), MessageTextFromValue( GetCanvas()->GetGAL()->GetGridSize().x,
false ) );
SetStatusText( msg, 4 );
}
@@ -736,21 +742,21 @@ void EDA_DRAW_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
void EDA_DRAW_FRAME::AppendMsgPanel( const wxString& aTextUpper, const wxString& aTextLower,
int aPadding )
{
if( m_messagePanel )
if( m_messagePanel && !m_isClosing )
m_messagePanel->AppendMessage( aTextUpper, aTextLower, aPadding );
}
void EDA_DRAW_FRAME::ClearMsgPanel()
{
if( m_messagePanel )
if( m_messagePanel && !m_isClosing )
m_messagePanel->EraseMsgBox();
}
void EDA_DRAW_FRAME::SetMsgPanel( const std::vector<MSG_PANEL_ITEM>& aList )
{
if( m_messagePanel )
if( m_messagePanel && !m_isClosing )
{
m_messagePanel->EraseMsgBox();
@@ -763,10 +769,9 @@ void EDA_DRAW_FRAME::SetMsgPanel( const std::vector<MSG_PANEL_ITEM>& aList )
void EDA_DRAW_FRAME::SetMsgPanel( const wxString& aTextUpper, const wxString& aTextLower,
int aPadding )
{
if( m_messagePanel )
if( m_messagePanel && !m_isClosing )
{
m_messagePanel->EraseMsgBox();
m_messagePanel->AppendMessage( aTextUpper, aTextLower, aPadding );
}
}
@@ -837,26 +842,15 @@ bool EDA_DRAW_FRAME::saveCanvasTypeSetting( EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvas
// Not all classes derived from EDA_DRAW_FRAME can save the canvas type, because some
// have a fixed type, or do not have a option to set the canvas type (they inherit from
// a parent frame)
FRAME_T allowed_frames[] =
{
FRAME_SCH, FRAME_SCH_SYMBOL_EDITOR,
FRAME_PCB_EDITOR, FRAME_FOOTPRINT_EDITOR,
FRAME_GERBER,
FRAME_PL_EDITOR
};
static std::vector<FRAME_T> s_allowedFrames =
{
FRAME_SCH, FRAME_SCH_SYMBOL_EDITOR,
FRAME_PCB_EDITOR, FRAME_FOOTPRINT_EDITOR,
FRAME_GERBER,
FRAME_PL_EDITOR
};
bool allow_save = false;
for( unsigned ii = 0; ii < arrayDim( allowed_frames ); ii++ )
{
if( m_ident == allowed_frames[ii] )
{
allow_save = true;
break;
}
}
if( !allow_save )
if( !alg::contains( s_allowedFrames, m_ident ) )
return false;
if( aCanvasType < EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE
@@ -866,9 +860,7 @@ bool EDA_DRAW_FRAME::saveCanvasTypeSetting( EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvas
return false;
}
APP_SETTINGS_BASE* cfg = Kiface().KifaceSettings();
if( cfg )
if( APP_SETTINGS_BASE* cfg = Kiface().KifaceSettings() )
cfg->m_Graphics.canvas_type = static_cast<int>( aCanvasType );
return false;
@@ -878,7 +870,7 @@ bool EDA_DRAW_FRAME::saveCanvasTypeSetting( EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvas
VECTOR2I EDA_DRAW_FRAME::GetNearestGridPosition( const VECTOR2I& aPosition ) const
{
const VECTOR2I& gridOrigin = GetGridOrigin();
VECTOR2D gridSize = GetCanvas()->GetGAL()->GetGridSize();
VECTOR2D gridSize = GetCanvas()->GetGAL()->GetGridSize();
double xOffset = fmod( gridOrigin.x, gridSize.x );
int x = KiROUND( (aPosition.x - xOffset) / gridSize.x );
@@ -892,7 +884,7 @@ VECTOR2I EDA_DRAW_FRAME::GetNearestGridPosition( const VECTOR2I& aPosition ) con
VECTOR2I EDA_DRAW_FRAME::GetNearestHalfGridPosition( const VECTOR2I& aPosition ) const
{
const VECTOR2I& gridOrigin = GetGridOrigin();
VECTOR2D gridSize = GetCanvas()->GetGAL()->GetGridSize() / 2.0;
VECTOR2D gridSize = GetCanvas()->GetGAL()->GetGridSize() / 2.0;
double xOffset = fmod( gridOrigin.x, gridSize.x );
int x = KiROUND( (aPosition.x - xOffset) / gridSize.x );
@@ -985,8 +977,8 @@ static const wxString productName = wxT( "KiCad E.D.A. " );
void PrintDrawingSheet( const RENDER_SETTINGS* aSettings, const PAGE_INFO& aPageInfo,
const wxString& aFullSheetName, const wxString& aFileName,
const TITLE_BLOCK& aTitleBlock,
const wxString& aSheetName, const wxString& aSheetPath,
const wxString& aFileName, const TITLE_BLOCK& aTitleBlock,
const std::map<wxString, wxString>* aProperties, int aSheetCount,
const wxString& aPageNumber, double aMils2Iu, const PROJECT* aProject,
const wxString& aSheetLayer, bool aIsFirstPage )
@@ -998,7 +990,8 @@ void PrintDrawingSheet( const RENDER_SETTINGS* aSettings, const PAGE_INFO& aPage
drawList.SetPageNumber( aPageNumber );
drawList.SetSheetCount( aSheetCount );
drawList.SetFileName( aFileName );
drawList.SetSheetName( aFullSheetName );
drawList.SetSheetName( aSheetName );
drawList.SetSheetPath( aSheetPath );
drawList.SetSheetLayer( aSheetLayer );
drawList.SetProject( aProject );
drawList.SetIsFirstPage( aIsFirstPage );
@@ -1028,9 +1021,10 @@ void EDA_DRAW_FRAME::PrintDrawingSheet( const RENDER_SETTINGS* aSettings, BASE_S
DC->SetAxisOrientation( true, false );
}
::PrintDrawingSheet( aSettings, GetPageSettings(), GetScreenDesc(), aFilename, GetTitleBlock(),
aProperties, aScreen->GetPageCount(), aScreen->GetPageNumber(), aMils2Iu,
&Prj(), aSheetLayer, aScreen->GetVirtualPageNumber() == 1 );
::PrintDrawingSheet( aSettings, GetPageSettings(), GetScreenDesc(), GetFullScreenDesc(),
aFilename, GetTitleBlock(), aProperties, aScreen->GetPageCount(),
aScreen->GetPageNumber(), aMils2Iu, &Prj(), aSheetLayer,
aScreen->GetVirtualPageNumber() == 1 );
if( origin.y > 0 )
{
@@ -1047,6 +1041,13 @@ wxString EDA_DRAW_FRAME::GetScreenDesc() const
}
wxString EDA_DRAW_FRAME::GetFullScreenDesc() const
{
// Virtual function. Base class implementation returns an empty string.
return wxEmptyString;
}
bool EDA_DRAW_FRAME::LibraryFileBrowser( bool doOpen, wxFileName& aFilename,
const wxString& wildcard, const wxString& ext,
bool isDirectory, bool aIsGlobal,
+3 -4
View File
@@ -392,10 +392,9 @@ static struct EDA_ITEM_DESC
PROPERTY_MANAGER& propMgr = PROPERTY_MANAGER::Instance();
REGISTER_TYPE( EDA_ITEM );
auto typeProp = new PROPERTY_ENUM<EDA_ITEM, KICAD_T>( wxS( "Type" ),
NO_SETTER( EDA_ITEM, KICAD_T ), &EDA_ITEM::Type );
typeProp->SetIsInternal( true );
propMgr.AddProperty( typeProp );
propMgr.AddProperty( new PROPERTY_ENUM<EDA_ITEM, KICAD_T>( wxS( "Type" ),
NO_SETTER( EDA_ITEM, KICAD_T ), &EDA_ITEM::Type ) )
.SetIsHiddenFromPropertiesManager();
}
} _EDA_ITEM_DESC;
+24
View File
@@ -412,6 +412,30 @@ bool EDA_COMBINED_MATCHER::Find( const wxString& aTerm, int& aMatchersTriggered,
}
bool EDA_COMBINED_MATCHER::Find( const wxString& aTerm )
{
for( const std::unique_ptr<EDA_PATTERN_MATCH>& matcher : m_matchers )
{
if( matcher->Find( aTerm ).start >= 0 )
return true;
}
return false;
}
bool EDA_COMBINED_MATCHER::StartsWith( const wxString& aTerm )
{
for( const std::unique_ptr<EDA_PATTERN_MATCH>& matcher : m_matchers )
{
if( matcher->Find( aTerm ).start == 0 )
return true;
}
return false;
}
wxString const& EDA_COMBINED_MATCHER::GetPattern() const
{
return m_pattern;
+30 -5
View File
@@ -1687,21 +1687,36 @@ static struct EDA_SHAPE_DESC
PROPERTY_MANAGER& propMgr = PROPERTY_MANAGER::Instance();
REGISTER_TYPE( EDA_SHAPE );
auto isNotPolygon =
[]( INSPECTABLE* aItem ) -> bool
{
// Polygons, unlike other shapes, have no meaningful start or end coordinates
if( EDA_SHAPE* shape = dynamic_cast<EDA_SHAPE*>( aItem ) )
return shape->GetShape() != SHAPE_T::POLY;
return false;
};
auto shape = new PROPERTY_ENUM<EDA_SHAPE, SHAPE_T>( _HKI( "Shape" ),
NO_SETTER( EDA_SHAPE, SHAPE_T ), &EDA_SHAPE::GetShape );
propMgr.AddProperty( shape );
propMgr.AddProperty( new PROPERTY<EDA_SHAPE, int>( _HKI( "Start X" ),
&EDA_SHAPE::SetStartX, &EDA_SHAPE::GetStartX, PROPERTY_DISPLAY::PT_COORD,
ORIGIN_TRANSFORMS::ABS_X_COORD ) );
ORIGIN_TRANSFORMS::ABS_X_COORD ) )
.SetAvailableFunc( isNotPolygon );
propMgr.AddProperty( new PROPERTY<EDA_SHAPE, int>( _HKI( "Start Y" ),
&EDA_SHAPE::SetStartY, &EDA_SHAPE::GetStartY, PROPERTY_DISPLAY::PT_COORD,
ORIGIN_TRANSFORMS::ABS_Y_COORD ) );
ORIGIN_TRANSFORMS::ABS_Y_COORD ) )
.SetAvailableFunc( isNotPolygon );
propMgr.AddProperty( new PROPERTY<EDA_SHAPE, int>( _HKI( "End X" ),
&EDA_SHAPE::SetEndX, &EDA_SHAPE::GetEndX, PROPERTY_DISPLAY::PT_COORD,
ORIGIN_TRANSFORMS::ABS_X_COORD ) );
ORIGIN_TRANSFORMS::ABS_X_COORD ) )
.SetAvailableFunc( isNotPolygon );
propMgr.AddProperty( new PROPERTY<EDA_SHAPE, int>( _HKI( "End Y" ),
&EDA_SHAPE::SetEndY, &EDA_SHAPE::GetEndY, PROPERTY_DISPLAY::PT_COORD,
ORIGIN_TRANSFORMS::ABS_Y_COORD ) );
ORIGIN_TRANSFORMS::ABS_Y_COORD ) )
.SetAvailableFunc( isNotPolygon );
// TODO: m_arcCenter, m_bezierC1, m_bezierC2, m_poly
propMgr.AddProperty( new PROPERTY<EDA_SHAPE, int>( _HKI( "Line Width" ),
&EDA_SHAPE::SetWidth, &EDA_SHAPE::GetWidth, PROPERTY_DISPLAY::PT_SIZE ) );
@@ -1721,7 +1736,17 @@ static struct EDA_SHAPE_DESC
filled->SetAvailableFunc(
[=]( INSPECTABLE* aItem ) -> bool
{
SHAPE_T itemShape = aItem->Get<SHAPE_T>( shape );
SHAPE_T itemShape;
try
{
itemShape = aItem->Get<SHAPE_T>( shape );
}
catch( std::runtime_error& err )
{
wxFAIL_MSG( err.what() );
return false;
}
switch( itemShape )
{
+24 -12
View File
@@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2004-2022 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2004-2023 KiCad Developers, see change_log.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
@@ -37,6 +37,7 @@
#include <callback_gal.h>
#include <eda_text.h> // for EDA_TEXT, TEXT_EFFECTS, GR_TEXT_VJUSTIF...
#include <gal/color4d.h> // for COLOR4D, COLOR4D::BLACK
#include <font/glyph.h>
#include <gr_text.h>
#include <string_utils.h> // for UnescapeString
#include <math/util.h> // for KiROUND
@@ -117,8 +118,10 @@ EDA_TEXT::EDA_TEXT( const EDA_TEXT& aText ) :
for( const std::unique_ptr<KIFONT::GLYPH>& glyph : aText.m_render_cache )
{
KIFONT::OUTLINE_GLYPH* outline_glyph = static_cast<KIFONT::OUTLINE_GLYPH*>( glyph.get() );
m_render_cache.emplace_back( std::make_unique<KIFONT::OUTLINE_GLYPH>( *outline_glyph ) );
if( KIFONT::OUTLINE_GLYPH* outline = dynamic_cast<KIFONT::OUTLINE_GLYPH*>( glyph.get() ) )
m_render_cache.emplace_back( std::make_unique<KIFONT::OUTLINE_GLYPH>( *outline ) );
else if( KIFONT::STROKE_GLYPH* stroke = dynamic_cast<KIFONT::STROKE_GLYPH*>( glyph.get() ) )
m_render_cache.emplace_back( std::make_unique<KIFONT::STROKE_GLYPH>( *stroke ) );
}
m_bounding_box_cache_valid = aText.m_bounding_box_cache_valid;
@@ -149,8 +152,10 @@ EDA_TEXT& EDA_TEXT::operator=( const EDA_TEXT& aText )
for( const std::unique_ptr<KIFONT::GLYPH>& glyph : aText.m_render_cache )
{
KIFONT::OUTLINE_GLYPH* outline_glyph = static_cast<KIFONT::OUTLINE_GLYPH*>( glyph.get() );
m_render_cache.emplace_back( std::make_unique<KIFONT::OUTLINE_GLYPH>( *outline_glyph ) );
if( KIFONT::OUTLINE_GLYPH* outline = dynamic_cast<KIFONT::OUTLINE_GLYPH*>( glyph.get() ) )
m_render_cache.emplace_back( std::make_unique<KIFONT::OUTLINE_GLYPH>( *outline ) );
else if( KIFONT::STROKE_GLYPH* stroke = dynamic_cast<KIFONT::STROKE_GLYPH*>( glyph.get() ) )
m_render_cache.emplace_back( std::make_unique<KIFONT::STROKE_GLYPH>( *stroke ) );
}
m_bounding_box_cache_valid = aText.m_bounding_box_cache_valid;
@@ -391,7 +396,12 @@ void EDA_TEXT::Offset( const VECTOR2I& aOffset )
m_pos += aOffset;
for( std::unique_ptr<KIFONT::GLYPH>& glyph : m_render_cache )
static_cast<KIFONT::OUTLINE_GLYPH*>( glyph.get() )->Move( aOffset );
{
if( KIFONT::OUTLINE_GLYPH* outline = dynamic_cast<KIFONT::OUTLINE_GLYPH*>( glyph.get() ) )
outline->Move( aOffset );
else if( KIFONT::STROKE_GLYPH* stroke = dynamic_cast<KIFONT::STROKE_GLYPH*>( glyph.get() ) )
glyph = stroke->Transform( { 1.0, 1.0 }, aOffset, 0, ANGLE_0, false, { 0, 0 } );
}
m_bounding_box_cache_valid = false;
}
@@ -467,7 +477,8 @@ EDA_TEXT::GetRenderCache( const KIFONT::FONT* aFont, const wxString& forResolved
attrs.m_Angle = resolvedAngle;
font->GetLinesAsGlyphs( &m_render_cache, GetShownText(), GetDrawPos() + aOffset, attrs );
font->GetLinesAsGlyphs( &m_render_cache, forResolvedText, GetDrawPos() + aOffset,
attrs );
m_render_cache_angle = resolvedAngle;
m_render_cache_text = forResolvedText;
m_render_cache_offset = aOffset;
@@ -514,7 +525,7 @@ BOX2I EDA_TEXT::GetTextBox( int aLine, bool aInvertY ) const
BOX2I bbox;
wxArrayString strings;
wxString text = GetShownText();
wxString text = GetShownText( true );
int thickness = GetEffectiveTextPenWidth();
if( IsMultilineAllowed() )
@@ -652,7 +663,7 @@ void EDA_TEXT::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset,
{
std::vector<VECTOR2I> positions;
wxArrayString strings;
wxStringSplit( GetShownText(), strings, '\n' );
wxStringSplit( GetShownText( true ), strings, '\n' );
positions.reserve( strings.Count() );
@@ -663,7 +674,8 @@ void EDA_TEXT::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset,
}
else
{
printOneLineOfText( aSettings, aOffset, aColor, aFillMode, GetShownText(), GetDrawPos() );
printOneLineOfText( aSettings, aOffset, aColor, aFillMode, GetShownText( true ),
GetDrawPos() );
}
}
@@ -884,7 +896,7 @@ std::shared_ptr<SHAPE_COMPOUND> EDA_TEXT::GetEffectiveTextShape( bool aTriangula
shape->AddShape( triShape );
} );
font->Draw( &callback_gal, GetShownText(), GetDrawPos(), attrs );
font->Draw( &callback_gal, GetShownText( true ), GetDrawPos(), attrs );
}
else
{
@@ -901,7 +913,7 @@ std::shared_ptr<SHAPE_COMPOUND> EDA_TEXT::GetEffectiveTextShape( bool aTriangula
shape->AddShape( aPoly.Clone() );
} );
font->Draw( &callback_gal, GetShownText(), GetDrawPos(), attrs );
font->Draw( &callback_gal, GetShownText( true ), GetDrawPos(), attrs );
}
return shape;
+4 -1
View File
@@ -65,7 +65,7 @@ int EDA_UNIT_UTILS::Mils2mm( double aVal )
}
void EDA_UNIT_UTILS::FetchUnitsFromString( const wxString& aTextValue, EDA_UNITS& aUnits )
bool EDA_UNIT_UTILS::FetchUnitsFromString( const wxString& aTextValue, EDA_UNITS& aUnits )
{
wxString buf( aTextValue.Strip( wxString::both ) );
unsigned brk_point = 0;
@@ -92,6 +92,9 @@ void EDA_UNIT_UTILS::FetchUnitsFromString( const wxString& aTextValue, EDA_UNITS
aUnits = EDA_UNITS::INCHES;
else if( unit == wxT( "de" ) || unit == wxT( "ra" ) ) // "deg" or "rad"
aUnits = EDA_UNITS::DEGREES;
else
return false;
return true;
}
+135 -38
View File
@@ -2,7 +2,7 @@
* This program source code file is part of KICAD, a free EDA CAD application.
*
* Copyright (C) 2021 Ola Rinta-Koski
* Copyright (C) 2021-2022 Kicad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2021-2023 Kicad Developers, see AUTHORS.txt for contributors.
*
* Font abstract base class
*
@@ -35,6 +35,7 @@
// The "official" name of the building Kicad stroke font (always existing)
#include <font/kicad_font_name.h>
#include "macros.h"
#include "wx/tokenzr.h"
// markup_parser.h includes pegtl.hpp which includes windows.h... which leaks #define DrawText
@@ -120,6 +121,13 @@ void FONT::getLinePositions( const wxString& aText, const VECTOR2I& aPosition,
VECTOR2I offset( 0, 0 );
offset.y += aAttrs.m_Size.y;
if( IsStroke() )
{
// Fudge factors to match 6.0 positioning
offset.x += aAttrs.m_StrokeWidth / 1.52;
offset.y -= aAttrs.m_StrokeWidth * 0.052;
}
switch( aAttrs.m_Valign )
{
case GR_TEXT_V_ALIGN_TOP: break;
@@ -138,7 +146,7 @@ void FONT::getLinePositions( const wxString& aText, const VECTOR2I& aPosition,
{
case GR_TEXT_H_ALIGN_LEFT: break;
case GR_TEXT_H_ALIGN_CENTER: lineOffset.x = -lineSize.x / 2; break;
case GR_TEXT_H_ALIGN_RIGHT: lineOffset.x = -lineSize.x; break;
case GR_TEXT_H_ALIGN_RIGHT: lineOffset.x = -( lineSize.x + offset.x ); break;
}
aPositions.push_back( aPosition + lineOffset );
@@ -191,6 +199,8 @@ VECTOR2I drawMarkup( BOX2I* aBoundingBox, std::vector<std::unique_ptr<GLYPH>>* a
bool aMirror, const VECTOR2I& aOrigin, TEXT_STYLE_FLAGS aTextStyle )
{
VECTOR2I nextPosition = aPosition;
bool drawUnderline = false;
bool drawOverbar = false;
if( aNode )
{
@@ -199,30 +209,79 @@ VECTOR2I drawMarkup( BOX2I* aBoundingBox, std::vector<std::unique_ptr<GLYPH>>* a
if( !aNode->is_root() )
{
if( aNode->isSubscript() )
textStyle = TEXT_STYLE::SUBSCRIPT;
textStyle |= TEXT_STYLE::SUBSCRIPT;
else if( aNode->isSuperscript() )
textStyle = TEXT_STYLE::SUPERSCRIPT;
textStyle |= TEXT_STYLE::SUPERSCRIPT;
if( aNode->isOverbar() )
textStyle |= TEXT_STYLE::OVERBAR;
drawOverbar = true;
if( aNode->has_content() )
{
BOX2I bbox;
nextPosition = aFont->GetTextAsGlyphs( &bbox, aGlyphs, aNode->asWxString(), aSize,
aPosition, aAngle, aMirror, aOrigin,
nextPosition, aAngle, aMirror, aOrigin,
textStyle );
if( aBoundingBox )
aBoundingBox->Merge( bbox );
}
}
else if( aTextStyle & TEXT_STYLE::UNDERLINE )
{
drawUnderline = true;
}
for( const std::unique_ptr<MARKUP::NODE>& child : aNode->children )
{
nextPosition = drawMarkup( aBoundingBox, aGlyphs, child, nextPosition, aFont, aSize,
aAngle, aMirror, aOrigin, textStyle );
aAngle, aMirror, aOrigin, textStyle );
}
}
if( drawUnderline )
{
// Shorten the bar a little so its rounded ends don't make it over-long
double barTrim = aSize.x * 0.1;
double barOffset = aFont->ComputeUnderlineVerticalPosition( aSize.y );
VECTOR2D barStart( aPosition.x + barTrim, aPosition.y - barOffset );
VECTOR2D barEnd( nextPosition.x - barTrim, nextPosition.y - barOffset );
if( aGlyphs )
{
STROKE_GLYPH barGlyph;
barGlyph.AddPoint( barStart );
barGlyph.AddPoint( barEnd );
barGlyph.Finalize();
aGlyphs->push_back( barGlyph.Transform( { 1.0, 1.0 }, { 0, 0 }, false, aAngle, aMirror,
aOrigin ) );
}
}
if( drawOverbar )
{
// Shorten the bar a little so its rounded ends don't make it over-long
double barTrim = aSize.x * 0.1;
double barOffset = aFont->ComputeOverbarVerticalPosition( aSize.y );
VECTOR2D barStart( aPosition.x + barTrim, aPosition.y - barOffset );
VECTOR2D barEnd( nextPosition.x - barTrim, nextPosition.y - barOffset );
if( aGlyphs )
{
STROKE_GLYPH barGlyph;
barGlyph.AddPoint( barStart );
barGlyph.AddPoint( barEnd );
barGlyph.Finalize();
aGlyphs->push_back( barGlyph.Transform( { 1.0, 1.0 }, { 0, 0 }, false, aAngle, aMirror,
aOrigin ) );
}
}
@@ -253,6 +312,7 @@ void FONT::drawSingleLineText( KIGFX::GAL* aGal, BOX2I* aBoundingBox, const wxSt
TEXT_STYLE_FLAGS textStyle = 0;
if( aItalic )
textStyle |= TEXT_STYLE::ITALIC;
@@ -281,8 +341,8 @@ VECTOR2I FONT::StringBoundaryLimits( const wxString& aText, const VECTOR2I& aSiz
if( aItalic )
textStyle |= TEXT_STYLE::ITALIC;
(void) drawMarkup( &boundingBox, nullptr, aText, VECTOR2I(), aSize, ANGLE_0, false,
VECTOR2I(), textStyle );
(void) drawMarkup( &boundingBox, nullptr, aText, VECTOR2I(), aSize, ANGLE_0, false, VECTOR2I(),
textStyle );
if( IsStroke() )
{
@@ -308,7 +368,7 @@ VECTOR2I FONT::boundingBoxSingleLine( BOX2I* aBBox, const wxString& aText,
textStyle |= TEXT_STYLE::ITALIC;
VECTOR2I extents = drawMarkup( aBBox, nullptr, aText, aPosition, aSize, ANGLE_0, false,
VECTOR2I(), textStyle );
VECTOR2I(), textStyle );
return extents;
}
@@ -376,20 +436,22 @@ void wordbreakMarkup( std::vector<std::pair<wxString, int>>* aWords,
}
else
{
wxString textRun = aNode->asWxString();
wxArrayString words;
wxString textRun = aNode->asWxString();
wxStringTokenizer tokenizer( textRun, " ", wxTOKEN_RET_DELIMS );
std::vector<wxString> words;
wxStringSplit( textRun, words, ' ' );
while( tokenizer.HasMoreTokens() )
words.emplace_back( tokenizer.GetNextToken() );
if( textRun.EndsWith( wxS( " " ) ) )
words.Add( wxS( " " ) );
for( size_t ii = 0; ii < words.size(); ++ii )
for( const wxString& word : words )
{
int w = aFont->GetTextAsGlyphs( nullptr, nullptr, words[ii], aSize, { 0, 0 },
wxString chars = word;
chars.Trim();
int w = aFont->GetTextAsGlyphs( nullptr, nullptr, chars, aSize, { 0, 0 },
ANGLE_0, false, { 0, 0 }, textStyle ).x;
aWords->emplace_back( std::make_pair( words[ii], w ) );
aWords->emplace_back( std::make_pair( word, w ) );
}
}
}
@@ -441,35 +503,70 @@ void FONT::LinebreakText( wxString& aText, int aColumnWidth, const VECTOR2I& aSi
for( size_t ii = 0; ii < textLines.Count(); ++ii )
{
bool virginLine = true;
int lineWidth = 0;
std::vector<std::pair<wxString, int>> markup;
std::vector<std::pair<wxString, int>> words;
wordbreakMarkup( &words, textLines[ii], aSize, textStyle );
wordbreakMarkup( &markup, textLines[ii], aSize, textStyle );
for( size_t jj = 0; jj < words.size(); /* advance in loop */ )
for( const auto& [ run, runWidth ] : markup )
{
if( virginLine )
if( !words.empty() && !words.back().first.EndsWith( ' ' ) )
{
// First word is always placed, even when wider than columnWidth.
aText += words[jj].first;
lineWidth += words[jj].second;
jj++;
virginLine = false;
}
else if( lineWidth + spaceWidth + words[jj].second < aColumnWidth - aThickness )
{
aText += " " + words[jj].first;
lineWidth += spaceWidth + words[jj].second;
jj++;
words.back().first += run;
words.back().second += runWidth;
}
else
{
aText += '\n';
words.emplace_back( std::make_pair( run, runWidth ) );
}
}
bool buryMode = false;
int lineWidth = 0;
wxString pendingSpaces;
for( const auto& [ word, wordWidth ] : words )
{
int pendingSpaceWidth = (int) pendingSpaces.Length() * spaceWidth;
bool overflow = lineWidth + pendingSpaceWidth + wordWidth > aColumnWidth - aThickness;
if( overflow && pendingSpaces.Length() > 0 )
{
aText += '\n';
lineWidth = 0;
virginLine = true;
pendingSpaces = wxEmptyString;
pendingSpaceWidth = 0;
buryMode = true;
}
if( word == wxS( " " ) )
{
pendingSpaces += word;
}
else
{
if( buryMode )
{
buryMode = false;
}
else
{
aText += pendingSpaces;
lineWidth += pendingSpaceWidth;
}
if( word.EndsWith( ' ' ) )
{
aText += word.Left( word.Length() - 1 );
pendingSpaces = wxS( " " );
}
else
{
aText += word;
pendingSpaces = wxEmptyString;
}
lineWidth += wordWidth;
}
}
+148 -33
View File
@@ -18,23 +18,25 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <fontconfig/fontconfig.h>
#include <font/fontconfig.h>
#include <pgm_base.h>
#include <wx/log.h>
#include <trace_helpers.h>
#include <string_utils.h>
#include <macros.h>
#include <font/fontconfig.h>
using namespace fontconfig;
static FONTCONFIG* g_config = nullptr;
inline static FcChar8* wxStringToFcChar8( const wxString& str )
/**
* A simple wrapper to avoid exporing fontconfig in the header
*/
struct fontconfig::FONTCONFIG_PAT
{
wxScopedCharBuffer const fcBuffer = str.ToUTF8();
return (FcChar8*) fcBuffer.data();
}
FcPattern* pat;
};
wxString FONTCONFIG::Version()
@@ -61,19 +63,112 @@ FONTCONFIG* Fontconfig()
}
bool FONTCONFIG::isLanguageMatch( const wxString& aSearchLang, const wxString& aSupportedLang )
{
if( aSearchLang.Lower() == aSupportedLang.Lower() )
return true;
if( aSupportedLang.empty() )
return false;
if( aSearchLang.empty() )
return false;
wxArrayString supportedLangBits;
wxStringSplit( aSupportedLang.Lower(), supportedLangBits, wxS( '-' ) );
wxArrayString searhcLangBits;
wxStringSplit( aSearchLang.Lower(), searhcLangBits, wxS( '-' ) );
// if either side of the comparison have only one section, then its a broad match but fine
// i.e. the haystack is declaring broad support or the search language is broad
if( searhcLangBits.size() == 1 || supportedLangBits.size() == 1 )
{
return searhcLangBits[0] == supportedLangBits[0];
}
// the full two part comparison should have passed the initial shortcut
return false;
}
std::string FONTCONFIG::getFcString( FONTCONFIG_PAT& aPat, const char* aObj, int aIdx )
{
FcChar8* str;
std::string res;
if( FcPatternGetString( aPat.pat, aObj, aIdx, &str ) == FcResultMatch )
res = std::string( reinterpret_cast<char*>( str ) );
return res;
}
void FONTCONFIG::getAllFamilyStrings( FONTCONFIG_PAT& aPat,
std::unordered_map<std::string, std::string>& aFamStringMap )
{
std::string famLang;
std::string fam;
int langIdx = 0;
do
{
famLang = getFcString( aPat, FC_FAMILYLANG, langIdx );
if( famLang.empty() && langIdx != 0 )
break;
else
{
fam = getFcString( aPat, FC_FAMILY, langIdx );
aFamStringMap.insert_or_assign( famLang, fam );
}
} while( langIdx++ < std::numeric_limits<
int8_t>::max() ); //arbitrary to avoid getting stuck for any reason
}
std::string FONTCONFIG::getFamilyStringByLang( FONTCONFIG_PAT& aPat, const wxString& aDesiredLang )
{
std::unordered_map<std::string, std::string> famStrings;
getAllFamilyStrings( aPat, famStrings );
if( famStrings.empty() )
return "";
for( auto const& [key, val] : famStrings )
{
if( isLanguageMatch( aDesiredLang, FROM_UTF8( key.c_str() ) ) )
{
return val;
}
}
// fall back to the first and maybe only available name
// most fonts by review don't even bother declaring more than one font family name
// and they don't even bother declare the language tag either, they just leave it blank
return famStrings.begin()->second;
}
FONTCONFIG::FF_RESULT FONTCONFIG::FindFont( const wxString &aFontName, wxString &aFontFile,
bool aBold, bool aItalic )
int& aFaceIndex, bool aBold, bool aItalic )
{
FF_RESULT retval = FF_RESULT::FF_ERROR;
wxString qualifiedFontName = aFontName;
wxScopedCharBuffer const fcBuffer = qualifiedFontName.ToUTF8();
FcPattern* pat = FcPatternCreate();
if( aBold )
qualifiedFontName << wxS( ":Bold" );
FcPatternAddString( pat, FC_STYLE, (const FcChar8*) "Bold" );
if( aItalic )
qualifiedFontName << wxS( ":Italic" );
FcPatternAddString( pat, FC_STYLE, (const FcChar8*) "Italic" );
FcPatternAddString( pat, FC_FAMILY, (FcChar8*) fcBuffer.data() );
FcPattern* pat = FcNameParse( wxStringToFcChar8( qualifiedFontName ) );
FcConfigSubstitute( nullptr, pat, FcMatchPattern );
FcDefaultSubstitute( pat );
@@ -89,14 +184,23 @@ FONTCONFIG::FF_RESULT FONTCONFIG::FindFont( const wxString &aFontName, wxString
if( FcPatternGetString( font, FC_FILE, 0, &file ) == FcResultMatch )
{
aFontFile = wxString::FromUTF8( (char*) file );
aFaceIndex = 0;
wxString styleStr;
FcChar8* family = nullptr;
FcChar8* style = nullptr;
retval = FF_RESULT::FF_SUBSTITUTE;
std::unordered_map<std::string, std::string> famStrings;
FONTCONFIG_PAT patHolder{ font };
getAllFamilyStrings( patHolder, famStrings );
if( FcPatternGetString( font, FC_FAMILY, 0, &family ) == FcResultMatch )
{
FcPatternGetInteger( font, FC_INDEX, 0, &aFaceIndex );
fontName = wxString::FromUTF8( (char*) family );
if( FcPatternGetString( font, FC_STYLE, 0, &style ) == FcResultMatch )
@@ -129,18 +233,26 @@ FONTCONFIG::FF_RESULT FONTCONFIG::FindFont( const wxString &aFontName, wxString
has_ital = true;
}
if( fontName.Lower().StartsWith( aFontName.Lower() ) )
for( auto const& [key, val] : famStrings )
{
if( ( aBold && !has_bold ) && ( aItalic && !has_ital ) )
retval = FF_RESULT::FF_MISSING_BOLD_ITAL;
else if( aBold && !has_bold )
retval = FF_RESULT::FF_MISSING_BOLD;
else if( aItalic && !has_ital )
retval = FF_RESULT::FF_MISSING_ITAL;
else if( ( aBold != has_bold ) || ( aItalic != has_ital ) )
retval = FF_RESULT::FF_SUBSTITUTE;
else
retval = FF_RESULT::FF_OK;
wxString searchFont;
searchFont = wxString::FromUTF8( (char*) val.data() );
if( searchFont.Lower().StartsWith( aFontName.Lower() ) )
{
if( ( aBold && !has_bold ) && ( aItalic && !has_ital ) )
retval = FF_RESULT::FF_MISSING_BOLD_ITAL;
else if( aBold && !has_bold )
retval = FF_RESULT::FF_MISSING_BOLD;
else if( aItalic && !has_ital )
retval = FF_RESULT::FF_MISSING_ITAL;
else if( ( aBold != has_bold ) || ( aItalic != has_ital ) )
retval = FF_RESULT::FF_SUBSTITUTE;
else
retval = FF_RESULT::FF_OK;
break;
}
}
}
}
@@ -158,13 +270,14 @@ FONTCONFIG::FF_RESULT FONTCONFIG::FindFont( const wxString &aFontName, wxString
}
void FONTCONFIG::ListFonts( std::vector<std::string>& aFonts )
void FONTCONFIG::ListFonts( std::vector<std::string>& aFonts, const std::string& aDesiredLang )
{
if( m_fonts.empty() )
// be sure to cache bust if the language changed
if( m_fontInfoCache.empty() || m_fontCacheLastLang != aDesiredLang )
{
FcPattern* pat = FcPatternCreate();
FcObjectSet* os = FcObjectSetBuild( FC_FAMILY, FC_STYLE, FC_LANG, FC_FILE, FC_OUTLINE,
nullptr );
FcObjectSet* os = FcObjectSetBuild( FC_FAMILY, FC_FAMILYLANG, FC_STYLE, FC_LANG, FC_FILE,
FC_OUTLINE, nullptr );
FcFontSet* fs = FcFontList( nullptr, pat, os );
for( int i = 0; fs && i < fs->nfont; ++i )
@@ -172,12 +285,10 @@ void FONTCONFIG::ListFonts( std::vector<std::string>& aFonts )
FcPattern* font = fs->fonts[i];
FcChar8* file;
FcChar8* style;
FcChar8* family;
FcLangSet* langSet;
FcBool outline;
if( FcPatternGetString( font, FC_FILE, 0, &file ) == FcResultMatch
&& FcPatternGetString( font, FC_FAMILY, 0, &family ) == FcResultMatch
&& FcPatternGetString( font, FC_STYLE, 0, &style ) == FcResultMatch
&& FcPatternGetLangSet( font, FC_LANG, 0, &langSet ) == FcResultMatch
&& FcPatternGetBool( font, FC_OUTLINE, 0, &outline ) == FcResultMatch )
@@ -185,7 +296,9 @@ void FONTCONFIG::ListFonts( std::vector<std::string>& aFonts )
if( !outline )
continue;
std::string theFamily( reinterpret_cast<char *>( family ) );
FONTCONFIG_PAT patHolder{ font };
std::string theFamily =
getFamilyStringByLang( patHolder, FROM_UTF8( aDesiredLang.c_str() ) );
#ifdef __WXMAC__
// On Mac (at least) some of the font names are in their own language. If
@@ -238,10 +351,10 @@ void FONTCONFIG::ListFonts( std::vector<std::string>& aFonts )
if( theFamily.length() > 0 && theFamily.front() == '.' )
continue;
std::map<std::string, FONTINFO>::iterator it = m_fonts.find( theFamily );
std::map<std::string, FONTINFO>::iterator it = m_fontInfoCache.find( theFamily );
if( it == m_fonts.end() )
m_fonts.emplace( theFamily, fontInfo );
if( it == m_fontInfoCache.end() )
m_fontInfoCache.emplace( theFamily, fontInfo );
else
it->second.Children().push_back( fontInfo );
}
@@ -249,8 +362,10 @@ void FONTCONFIG::ListFonts( std::vector<std::string>& aFonts )
if( fs )
FcFontSetDestroy( fs );
m_fontCacheLastLang = aDesiredLang;
}
for( const std::pair<const std::string, FONTINFO>& entry : m_fonts )
for( const std::pair<const std::string, FONTINFO>& entry : m_fontInfoCache )
aFonts.push_back( entry.second.Family() );
}
+36 -91
View File
@@ -2,7 +2,7 @@
* This program source code file is part of KICAD, a free EDA CAD application.
*
* Copyright (C) 2021 Ola Rinta-Koski <gitlab@rinta-koski.net>
* Copyright (C) 2021-2022 Kicad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2021-2023 Kicad Developers, see AUTHORS.txt for contributors.
*
* Outline font class
*
@@ -44,6 +44,7 @@ using namespace KIFONT;
FT_Library OUTLINE_FONT::m_freeType = nullptr;
std::mutex OUTLINE_FONT::m_freeTypeMutex;
OUTLINE_FONT::OUTLINE_FONT() :
m_face(NULL),
@@ -51,6 +52,8 @@ OUTLINE_FONT::OUTLINE_FONT() :
m_fakeBold( false ),
m_fakeItal( false )
{
std::lock_guard<std::mutex> guard( m_freeTypeMutex );
if( !m_freeType )
FT_Init_FreeType( &m_freeType );
}
@@ -58,6 +61,8 @@ OUTLINE_FONT::OUTLINE_FONT() :
wxString OUTLINE_FONT::FreeTypeVersion()
{
std::lock_guard<std::mutex> guard( m_freeTypeMutex );
if( !m_freeType )
FT_Init_FreeType( &m_freeType );
@@ -90,12 +95,16 @@ wxString OUTLINE_FONT::FontLibraryVersion()
OUTLINE_FONT* OUTLINE_FONT::LoadFont( const wxString& aFontName, bool aBold, bool aItalic )
{
OUTLINE_FONT* font = new OUTLINE_FONT();
std::unique_ptr<OUTLINE_FONT> font = std::make_unique<OUTLINE_FONT>();
wxString fontFile;
int faceIndex;
using fc = fontconfig::FONTCONFIG;
fc::FF_RESULT retval = Fontconfig()->FindFont( aFontName, fontFile, aBold, aItalic );
fc::FF_RESULT retval = Fontconfig()->FindFont( aFontName, fontFile, faceIndex, aBold, aItalic );
if( retval == fc::FF_RESULT::FF_ERROR )
return nullptr;
if( retval == fc::FF_RESULT::FF_MISSING_BOLD || retval == fc::FF_RESULT::FF_MISSING_BOLD_ITAL )
font->SetFakeBold();
@@ -103,21 +112,23 @@ OUTLINE_FONT* OUTLINE_FONT::LoadFont( const wxString& aFontName, bool aBold, boo
if( retval == fc::FF_RESULT::FF_MISSING_ITAL || retval == fc::FF_RESULT::FF_MISSING_BOLD_ITAL )
font->SetFakeItal();
if( retval != fc::FF_RESULT::FF_ERROR )
(void) font->loadFace( fontFile );
if( font->loadFace( fontFile, faceIndex ) != 0 )
return nullptr;
font->m_fontName = aFontName; // Keep asked-for name, even if we substituted.
font->m_fontFileName = fontFile;
return font;
return font.release();
}
FT_Error OUTLINE_FONT::loadFace( const wxString& aFontFileName )
FT_Error OUTLINE_FONT::loadFace( const wxString& aFontFileName, int aFaceIndex )
{
std::lock_guard<std::mutex> guard( m_freeTypeMutex );
// TODO: check that going from wxString to char* with UTF-8
// conversion for filename makes sense on any/all platforms
FT_Error e = FT_New_Face( m_freeType, aFontFileName.mb_str( wxConvUTF8 ), 0, &m_face );
FT_Error e = FT_New_Face( m_freeType, aFontFileName.mb_str( wxConvUTF8 ), aFaceIndex, &m_face );
if( !e )
{
@@ -302,27 +313,24 @@ VECTOR2I OUTLINE_FONT::GetTextAsGlyphs( BOX2I* aBBox, std::vector<std::unique_pt
}
double OUTLINE_FONT::getOverbarOffset( int ascender, int height, int thickness ) const
{
double thicknessRatio = abs( (double) thickness ) / (double) height;
double ascenderRatio = (double) ascender / (double) height;
if( thicknessRatio < 0.05 )
return 0.04;
else if( ascenderRatio < 0.78 )
return 0.00;
else if( ascenderRatio < 0.80 )
return -0.03;
else
return -0.06;
}
VECTOR2I OUTLINE_FONT::getTextAsGlyphs( BOX2I* aBBox, std::vector<std::unique_ptr<GLYPH>>* aGlyphs,
const wxString& aText, const VECTOR2I& aSize,
const VECTOR2I& aPosition, const EDA_ANGLE& aAngle,
bool aMirror, const VECTOR2I& aOrigin,
TEXT_STYLE_FLAGS aTextStyle ) const
{
std::lock_guard<std::mutex> guard( m_freeTypeMutex );
return getTextAsGlyphsUnlocked( aBBox, aGlyphs, aText, aSize, aPosition, aAngle, aMirror,
aOrigin, aTextStyle );
}
VECTOR2I OUTLINE_FONT::getTextAsGlyphsUnlocked( BOX2I* aBBox,
std::vector<std::unique_ptr<GLYPH>>* aGlyphs,
const wxString& aText, const VECTOR2I& aSize,
const VECTOR2I& aPosition, const EDA_ANGLE& aAngle,
bool aMirror, const VECTOR2I& aOrigin,
TEXT_STYLE_FLAGS aTextStyle ) const
{
VECTOR2D glyphSize = aSize;
FT_Face face = m_face;
@@ -366,7 +374,7 @@ VECTOR2I OUTLINE_FONT::getTextAsGlyphs( BOX2I* aBBox, std::vector<std::unique_pt
{
FT_Matrix matrix;
// Create a 12 degree slant
const float angle = ( -M_PI * 12 ) / 180.0f;
const float angle = (float)( -M_PI * 12.0f ) / 180.0f;
matrix.xx = (FT_Fixed) ( cos( angle ) * 0x10000L );
matrix.xy = (FT_Fixed) ( -sin( angle ) * 0x10000L );
matrix.yx = (FT_Fixed) ( 0 * 0x10000L ); // Don't rotate in the y direction
@@ -455,75 +463,9 @@ VECTOR2I OUTLINE_FONT::getTextAsGlyphs( BOX2I* aBBox, std::vector<std::unique_pt
}
int ascender = abs( face->size->metrics.ascender * GLYPH_SIZE_SCALER );
int height = abs( face->size->metrics.height * GLYPH_SIZE_SCALER );
int descender = abs( face->size->metrics.descender * GLYPH_SIZE_SCALER );
VECTOR2I extents( cursor.x * scaleFactor.x, ( ascender + descender ) * abs( scaleFactor.y ) );
// Font metrics don't include all descenders and diacriticals, so beef them up just a little.
extents.y *= 1.05;
if( IsOverbar( aTextStyle ) )
{
std::vector<std::unique_ptr<GLYPH>> underscoreGlyphs;
getTextAsGlyphs( nullptr, &underscoreGlyphs, wxT( "_" ), aSize, { 0, 0 }, ANGLE_0, false,
{ 0, 0 }, aTextStyle & ~TEXT_STYLE::OVERBAR );
OUTLINE_GLYPH* underscoreGlyph = static_cast<OUTLINE_GLYPH*>( underscoreGlyphs[0].get() );
BOX2I underscoreBBox;
for( const VECTOR2I& pt : underscoreGlyph->Outline( 0 ).CPoints() )
underscoreBBox.Merge( pt );
int barThickness = underscoreBBox.GetHeight();
// Shorten the bar a little so its rounded ends don't make it over-long
double barTrim = barThickness / 2.0;
double barOffset = getOverbarOffset( ascender, height, barThickness / scaleFactor.y );
VECTOR2I topLeft( aPosition );
VECTOR2I topRight( aPosition );
topLeft.y += ascender * scaleFactor.y * ( 1.0 + barOffset );
topRight.y = topLeft.y;
topLeft.x += barTrim;
topRight.x += extents.x - barTrim;
extents.y *= ( 1.0 + barOffset + barOffset );
extents.x += barTrim;
if( IsItalic() )
{
topLeft.x += aSize.y * ITALIC_TILT;
topRight.x += aSize.y * ITALIC_TILT;
extents.x += aSize.y * ITALIC_TILT;
}
if( aMirror )
{
topLeft.x = aOrigin.x - ( topLeft.x - aOrigin.x );
topRight.x = aOrigin.x - ( topRight.x - aOrigin.x );
}
if( !aAngle.IsZero() )
{
RotatePoint( topLeft, aOrigin, aAngle );
RotatePoint( topRight, aOrigin, aAngle );
}
if( aGlyphs )
{
int maxError = KiROUND( barThickness / 48 );
SHAPE_POLY_SET poly;
TransformOvalToPolygon( poly, topLeft, topRight, barThickness, maxError, ERROR_INSIDE );
std::unique_ptr<OUTLINE_GLYPH> overbarGlyph = std::make_unique<OUTLINE_GLYPH>( poly );
aGlyphs->push_back( std::move( overbarGlyph ) );
}
}
hb_buffer_destroy( buf );
hb_font_destroy( referencedFont );
@@ -552,6 +494,9 @@ void OUTLINE_FONT::RenderToOpenGLCanvas( KIGFX::OPENGL_GAL& aGal, const wxString
unsigned int glyphCount;
hb_glyph_info_t* glyphInfo = hb_buffer_get_glyph_infos( buf, &glyphCount );
hb_glyph_position_t* glyphPos = hb_buffer_get_glyph_positions( buf, &glyphCount );
std::lock_guard<std::mutex> guard( m_freeTypeMutex );
hb_font_t* referencedFont = hb_ft_font_create_referenced( m_face );
hb_ft_font_set_funcs( referencedFont );
+25 -71
View File
@@ -4,7 +4,7 @@
* Copyright (C) 2012 Torsten Hueter, torstenhtr <at> gmx.de
* Copyright (C) 2013 CERN
* @author Maciej Suminski <maciej.suminski@cern.ch>
* Copyright (C) 2016-2022 Kicad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2016-2023 Kicad Developers, see AUTHORS.txt for contributors.
*
* Stroke font class
*
@@ -44,7 +44,7 @@ using namespace KIFONT;
///< Factor that determines relative vertical position of the overbar.
static constexpr double OVERBAR_POSITION_FACTOR = 1.40;
static constexpr double OVERBAR_POSITION_FACTOR = 1.23;
///< Factor that determines relative vertical position of the underline.
static constexpr double UNDERLINE_POSITION_FACTOR = -0.16;
@@ -52,7 +52,8 @@ static constexpr double UNDERLINE_POSITION_FACTOR = -0.16;
///< Scale factor for a glyph
static constexpr double STROKE_FONT_SCALE = 1.0 / 21.0;
static constexpr int FONT_OFFSET = -10;
///< Offset (in stroke font units) to move the origin to the baseline.
static constexpr int FONT_OFFSET = -8;
bool g_defaultFontInitialized = false;
@@ -127,7 +128,6 @@ void STROKE_FONT::loadNewStrokeFont( const char* const aNewStrokeFont[], int aNe
while( aNewStrokeFont[j][i] )
{
if( aNewStrokeFont[j][i] == ' ' && aNewStrokeFont[j][i+1] == 'R' )
strokes++;
@@ -225,18 +225,17 @@ VECTOR2I STROKE_FONT::GetTextAsGlyphs( BOX2I* aBBox, std::vector<std::unique_ptr
bool aMirror, const VECTOR2I& aOrigin,
TEXT_STYLE_FLAGS aTextStyle ) const
{
constexpr double SPACE_WIDTH = 0.6;
constexpr int TAB_WIDTH = 4;
constexpr double INTER_CHAR = 0.2;
constexpr double TAB_WIDTH = 4 * 0.82; // Not quite as wide as 5.1/6.0 tab formatting, but
// a better match for Scintilla, and closer to the
// nominal SPACE_WIDTH + INTER_CHAR
constexpr double SUPER_SUB_SIZE_MULTIPLIER = 0.7;
constexpr double SUPER_HEIGHT_OFFSET = 0.5;
constexpr double SUB_HEIGHT_OFFSET = 0.3;
constexpr double SUPER_SUB_SIZE_MULTIPLIER = 0.8;
constexpr double SUPER_HEIGHT_OFFSET = 0.35;
constexpr double SUB_HEIGHT_OFFSET = 0.15;
VECTOR2I cursor( aPosition );
VECTOR2D glyphSize( aSize );
double tilt = ( aTextStyle & TEXT_STYLE::ITALIC ) ? ITALIC_TILT : 0.0;
double space_width = m_glyphBoundingBoxes->front().GetWidth(); // First char is space
int char_count = 0;
if( aTextStyle & TEXT_STYLE::SUBSCRIPT || aTextStyle & TEXT_STYLE::SUPERSCRIPT )
{
@@ -250,18 +249,26 @@ VECTOR2I STROKE_FONT::GetTextAsGlyphs( BOX2I* aBBox, std::vector<std::unique_ptr
for( wxUniChar c : aText )
{
// Handle tabs as locked to the nearest 4th column (in space-widths).
// Handle tabs as locked to the next 4th column (in base-widths).
if( c == '\t' )
{
int tabWidth = KiROUND( glyphSize.x * TAB_WIDTH );
int currentIntrusion = ( cursor.x - aOrigin.x ) % tabWidth;
char_count = ( char_count / TAB_WIDTH + 1 ) * TAB_WIDTH - 1;
cursor.x += tabWidth - currentIntrusion;
int new_cursor = aPosition.x + aSize.x * char_count
+ aSize.x * space_width;
while( new_cursor <= cursor.x )
{
char_count += TAB_WIDTH;
new_cursor += aSize.x * TAB_WIDTH;
}
cursor.x = new_cursor;
}
else if( c == ' ' )
{
// 'space' character - draw nothing, advance cursor position
cursor.x += KiROUND( glyphSize.x * SPACE_WIDTH );
cursor.x += KiROUND( glyphSize.x * space_width );
}
else
{
@@ -287,69 +294,16 @@ VECTOR2I STROKE_FONT::GetTextAsGlyphs( BOX2I* aBBox, std::vector<std::unique_ptr
glyphExtents *= glyphSize;
if( tilt > 0.0 )
glyphExtents.x -= glyphExtents.y * tilt;
cursor.x += KiROUND( glyphExtents.x );
}
}
VECTOR2D barOffset( 0.0, 0.0 );
// Shorten the bar a little so its rounded ends don't make it over-long
double barTrim = glyphSize.x * 0.1;
if( aTextStyle & TEXT_STYLE::OVERBAR )
{
barOffset.y = ComputeOverbarVerticalPosition( glyphSize.y );
if( aTextStyle & TEXT_STYLE::ITALIC )
barOffset.x = barOffset.y * ITALIC_TILT;
VECTOR2D barStart( aPosition.x + barOffset.x + barTrim, cursor.y - barOffset.y );
VECTOR2D barEnd( cursor.x + barOffset.x - barTrim, cursor.y - barOffset.y );
if( aGlyphs )
{
STROKE_GLYPH overbarGlyph;
overbarGlyph.AddPoint( barStart );
overbarGlyph.AddPoint( barEnd );
overbarGlyph.Finalize();
aGlyphs->push_back( overbarGlyph.Transform( { 1.0, 1.0 }, { 0, 0 }, false,
aAngle, aMirror, aOrigin ) );
}
}
if( aTextStyle & TEXT_STYLE::UNDERLINE )
{
barOffset.y = ComputeUnderlineVerticalPosition( glyphSize.y );
if( aTextStyle & TEXT_STYLE::ITALIC )
barOffset.x = barOffset.y * ITALIC_TILT;
VECTOR2D barStart( aPosition.x + barOffset.x + barTrim, cursor.y - barOffset.y );
VECTOR2D barEnd( cursor.x + barOffset.x - barTrim, cursor.y - barOffset.y );
if( aGlyphs )
{
STROKE_GLYPH underlineGlyph;
underlineGlyph.AddPoint( barStart );
underlineGlyph.AddPoint( barEnd );
underlineGlyph.Finalize();
aGlyphs->push_back( underlineGlyph.Transform( { 1.0, 1.0 }, { 0, 0 }, false,
aAngle, aMirror, aOrigin ) );
}
++char_count;
}
if( aBBox )
{
aBBox->SetOrigin( aPosition );
aBBox->SetEnd( cursor.x + barOffset.x - KiROUND( glyphSize.x * INTER_CHAR ),
cursor.y + std::max( glyphSize.y, barOffset.y * OVERBAR_POSITION_FACTOR ) );
aBBox->SetEnd( cursor.x - KiROUND( glyphSize.x * INTER_CHAR ), cursor.y + glyphSize.y );
aBBox->Normalize();
}
+2 -3
View File
@@ -86,12 +86,11 @@ void FOOTPRINT_FILTER_IT::increment()
candidate.GetLibNickname(),
candidate.GetFootprintName(),
candidate.GetSearchText() );
int matches, position;
bool exclude = false;
bool exclude = false;
for( std::unique_ptr<EDA_COMBINED_MATCHER>& matcher : m_filter->m_pattern_filters )
{
if( !matcher->Find( searchStr.Lower(), matches, position ) )
if( !matcher->Find( searchStr.Lower() ) )
{
exclude = true;
break;
+1
View File
@@ -596,6 +596,7 @@ bool FP_LIB_TABLE::LoadGlobalTable( FP_LIB_TABLE& aTable )
}
}
aTable.Clear();
aTable.Load( fn.GetFullPath() );
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
+1 -1
View File
@@ -180,7 +180,7 @@ bool COLOR4D::SetFromHexString( const wxString& aColorString )
str.Trim( true );
str.Trim( false );
if( str.length() < 7 || str.GetChar( 0 ) != '#' )
if( str.length() < 7 || !str.StartsWith( '#' ) )
return false;
unsigned long tmp;
+47 -13
View File
@@ -57,11 +57,6 @@ static std::optional<double> getKiCadConfiguredScale( const COMMON_SETTINGS& aCo
scale = canvas_scale;
}
if( scale )
{
wxLogTrace( traceHiDpi, wxS( "Scale factor (configured): %f" ), *scale );
}
return scale;
}
@@ -83,11 +78,6 @@ static std::optional<double> getEnvironmentScale()
scale = ENV_VAR::GetEnvVar<double>( wxS( "GDK_SCALE" ) );
}
if( scale )
{
wxLogTrace( traceHiDpi, wxS( "Scale factor (environment): %f" ), *scale );
}
return scale;
}
@@ -101,15 +91,18 @@ DPI_SCALING::DPI_SCALING( COMMON_SETTINGS* aConfig, const wxWindow* aWindow )
double DPI_SCALING::GetScaleFactor() const
{
std::optional<double> val;
wxString src;
if( m_config )
{
val = getKiCadConfiguredScale( *m_config );
src = wxS( "config" );
}
if( !val )
{
val = getEnvironmentScale();
src = wxS( "env" );
}
if( !val && m_window )
@@ -117,17 +110,58 @@ double DPI_SCALING::GetScaleFactor() const
// Use the native WX reporting.
// On Linux, this will not work until WX 3.2 and GTK >= 3.10
// Otherwise it returns 1.0
val = KIPLATFORM::UI::GetSystemScaleFactor( m_window );
wxLogTrace( traceHiDpi, wxS( "Scale factor (WX): %f" ), *val );
val = KIPLATFORM::UI::GetPixelScaleFactor( m_window );
src = wxS( "platform" );
}
if( !val )
{
// Nothing else we can do, give it a default value
val = GetDefaultScaleFactor();
wxLogTrace( traceHiDpi, wxS( "Scale factor (default): %f" ), *val );
src = wxS( "default" );
}
wxLogTrace( traceHiDpi, wxS( "Scale factor (%s): %f" ), src, *val );
return *val;
}
double DPI_SCALING::GetContentScaleFactor() const
{
std::optional<double> val;
wxString src;
if( m_config )
{
val = getKiCadConfiguredScale( *m_config );
src = wxS( "config" );
}
if( !val )
{
val = getEnvironmentScale();
src = wxS( "env" );
}
if( !val && m_window )
{
// Use the native WX reporting.
// On Linux, this will not work until WX 3.2 and GTK >= 3.10
// Otherwise it returns 1.0
val = KIPLATFORM::UI::GetContentScaleFactor( m_window );
src = wxS( "platform" );
}
if( !val )
{
// Nothing else we can do, give it a default value
val = GetDefaultScaleFactor();
src = wxS( "default" );
}
wxLogTrace( traceHiDpi, wxS( "Content scale factor (%s): %f" ), src, *val );
return *val;
}
+11 -18
View File
@@ -169,14 +169,6 @@ GLuint GL_BITMAP_CACHE::cacheBitmap( const BITMAP_BASE* aBitmap )
bmp.w = imgData.GetSize().x;
bmp.h = imgData.GetSize().y;
// The bitmap size needs to be a multiple of 4.
// This is easiest to achieve by ensuring that each row
// has a multiple of 4 pixels
int extra_w = bmp.w % 4;
if( extra_w )
extra_w = 4 - extra_w;
GLuint textureID;
if( m_freedTextureIds.empty() )
@@ -189,15 +181,14 @@ GLuint GL_BITMAP_CACHE::cacheBitmap( const BITMAP_BASE* aBitmap )
m_freedTextureIds.pop_front();
}
// make_unique initializes this to 0, so extra pixels are transparent
bmp.size = ( bmp.w + extra_w ) * bmp.h * 4;
bmp.size = bmp.w * bmp.h * 4;
auto buf = std::make_unique<uint8_t[]>( bmp.size );
for( int y = 0; y < bmp.h; y++ )
{
for( int x = 0; x < bmp.w; x++ )
{
uint8_t* p = buf.get() + ( ( bmp.w + extra_w ) * y + x ) * 4;
uint8_t* p = buf.get() + ( bmp.w * y + x ) * 4;
p[0] = imgData.GetRed( x, y );
p[1] = imgData.GetGreen( x, y );
@@ -214,7 +205,7 @@ GLuint GL_BITMAP_CACHE::cacheBitmap( const BITMAP_BASE* aBitmap )
}
glBindTexture( GL_TEXTURE_2D, textureID );
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA8, bmp.w + extra_w, bmp.h, 0, GL_RGBA, GL_UNSIGNED_BYTE,
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA8, bmp.w, bmp.h, 0, GL_RGBA, GL_UNSIGNED_BYTE,
buf.get() );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
@@ -1427,21 +1418,23 @@ void OPENGL_GAL::DrawBitmap( const BITMAP_BASE& aBitmap, double alphaBlend )
glActiveTexture( GL_TEXTURE0 );
glBindTexture( GL_TEXTURE_2D, texture_id );
float texStartX = aBitmap.IsMirrored() ? 1.0 : 0.0;
float texEndX = aBitmap.IsMirrored() ? 0.0 : 1.0;
float texStartX = aBitmap.IsMirroredX() ? 1.0 : 0.0;
float texEndX = aBitmap.IsMirroredX() ? 0.0 : 1.0;
float texStartY = aBitmap.IsMirroredY() ? 1.0 : 0.0;
float texEndY = aBitmap.IsMirroredY() ? 0.0 : 1.0;
glBegin( GL_QUADS );
glColor4f( 1.0, 1.0, 1.0, alpha );
glTexCoord2f( texStartX, 0.0 );
glTexCoord2f( texStartX, texStartY );
glVertex3f( v0.x, v0.y, m_layerDepth );
glColor4f( 1.0, 1.0, 1.0, alpha );
glTexCoord2f( texEndX, 0.0 );
glTexCoord2f( texEndX, texStartY);
glVertex3f( v1.x, v0.y, m_layerDepth );
glColor4f( 1.0, 1.0, 1.0, alpha );
glTexCoord2f( texEndX, 1.0 );
glTexCoord2f( texEndX, texEndY);
glVertex3f( v1.x, v1.y, m_layerDepth );
glColor4f( 1.0, 1.0, 1.0, alpha );
glTexCoord2f( texStartX, 1.0 );
glTexCoord2f( texStartX, texEndY);
glVertex3f( v0.x, v1.y, m_layerDepth );
glEnd();
+5
View File
@@ -91,6 +91,11 @@ void GRSetColorPen( wxDC* DC, const COLOR4D& Color, int width, wxPenStyle style
if( s_ForceBlackPen )
color = COLOR4D::BLACK;
// wxWidgets will enforce a minimum pen width when printing, so we have to make the pen
// transparent when we don't want the object stroked.
if( width == 0 )
color = COLOR4D::UNSPECIFIED;
const wxPen& curr_pen = DC->GetPen();
if( !curr_pen.IsOk() || curr_pen.GetColour() != color.ToColour()
+18 -2
View File
@@ -418,12 +418,20 @@ void GRID_TRICKS::onCharHook( wxKeyEvent& ev )
{
bool handled = false;
if( ev.GetKeyCode() == WXK_RETURN && m_grid->GetGridCursorRow() == m_grid->GetNumberRows() - 1 )
if( ( ev.GetKeyCode() == WXK_RETURN || ev.GetKeyCode() == WXK_NUMPAD_ENTER )
&& ev.GetModifiers() == wxMOD_NONE
&& m_grid->GetGridCursorRow() == m_grid->GetNumberRows() - 1 )
{
if( m_grid->CommitPendingChanges() )
if( m_grid->IsCellEditControlShown() )
{
if( m_grid->CommitPendingChanges() )
handled = true;
}
else
{
wxCommandEvent dummy;
m_addHandler( dummy );
handled = true;
}
}
else if( ev.GetModifiers() == wxMOD_CONTROL && ev.GetKeyCode() == 'V' )
@@ -448,6 +456,14 @@ void GRID_TRICKS::onCharHook( wxKeyEvent& ev )
m_grid->ForceRefresh();
}
}
else if( ev.GetKeyCode() == WXK_ESCAPE )
{
if( m_grid->IsCellEditControlShown() )
{
m_grid->CancelPendingChanges();
handled = true;
}
}
if( !handled )
ev.Skip( true );
+3 -91
View File
@@ -27,109 +27,21 @@
// conflicts for some defines, at least on Windows
#include <kicad_curl/kicad_curl.h>
#include <mutex>
#include <ki_exception.h> // THROW_IO_ERROR
// These are even more private than class members, and since there is only
// one instance of KICAD_CURL ever, these statics are hidden here to simplify the
// client (API) header file.
static volatile bool s_initialized;
static std::mutex s_lock; // for s_initialized
/// At process termination, using atexit() keeps the CURL stuff out of the
/// singletops and PGM_BASE.
static void at_terminate()
{
KICAD_CURL::Cleanup();
}
void KICAD_CURL::Init()
{
// We test s_initialized twice in an effort to avoid
// unnecessarily locking s_lock. This understands that the common case
// will not need to lock.
if( !s_initialized )
if( curl_global_init( CURL_GLOBAL_ALL ) != CURLE_OK )
{
std::lock_guard<std::mutex> lock( s_lock );
if( !s_initialized )
{
if( curl_global_init( CURL_GLOBAL_ALL ) != CURLE_OK )
{
THROW_IO_ERROR( "curl_global_init() failed." );
}
s_initialized = true;
}
THROW_IO_ERROR( "curl_global_init() failed." );
}
}
void KICAD_CURL::Cleanup()
{
/*
Calling lock_guard() from a static destructor will typically be bad, since the
s_lock may already have been statically destroyed itself leading to a boost
exception. (Remember C++ does not provide certain sequencing of static
destructor invocation.)
To prevent this we test s_initialized twice, which ensures that the lock_guard
is only instantiated on the first call, which should be from
PGM_BASE::destroy() which is first called earlier than static destruction.
Then when called again from the actual PGM_BASE::~PGM_BASE() function,
lock_guard will not be instantiated because s_initialized will be false.
*/
if( s_initialized )
{
std::lock_guard<std::mutex> lock( s_lock );
if( s_initialized )
{
curl_global_cleanup();
atexit( &at_terminate );
s_initialized = false;
}
}
}
std::string KICAD_CURL::GetSimpleVersion()
{
if( !s_initialized )
Init();
curl_version_info_data* info = curl_version_info( CURLVERSION_NOW );
std::string res;
if( info->version )
{
res += "libcurl version: " + std::string( info->version );
}
res += " (";
if( info->features & CURL_VERSION_SSL )
{
res += "with SSL - ";
res += std::string( info->ssl_version );
}
else
{
res += "without SSL";
}
res += ")";
return res;
curl_global_cleanup();
}
+9 -10
View File
@@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2015 Mark Roszko <mark.roszko@gmail.com>
* Copyright (C) 2015-2021 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2015-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
@@ -100,23 +100,18 @@ static int xferinfo( void* aProgress, curl_off_t aDLtotal, curl_off_t aDLnow, cu
return CURLE_OK;
}
#if LIBCURL_VERSION_NUM < 0x072000 // 7.32.0
static int progressinfo( void* aProgress, double aDLtotal, double aDLnow, double aULtotal, double aULnow )
{
return xferinfo( aProgress, static_cast<curl_off_t>( aDLtotal ), static_cast<curl_off_t>( aDLnow ),
static_cast<curl_off_t>( aULtotal ), static_cast<curl_off_t>( aULnow ) );
}
#endif
KICAD_CURL_EASY::KICAD_CURL_EASY() :
m_headers( nullptr )
{
// Call KICAD_CURL::Init() from in here every time, but only the first time
// will incur any overhead. This strategy ensures that libcurl is never loaded
// unless it is needed.
KICAD_CURL::Init();
m_CURL = curl_easy_init();
if( !m_CURL )
@@ -126,7 +121,11 @@ KICAD_CURL_EASY::KICAD_CURL_EASY() :
curl_easy_setopt( m_CURL, CURLOPT_WRITEDATA, static_cast<void*>( &m_buffer ) );
// Only allow HTTP and HTTPS protocols
#if LIBCURL_VERSION_NUM >= 0x075500 // version 7.85.0
curl_easy_setopt(m_CURL, CURLOPT_PROTOCOLS_STR, "http,https");
#else
curl_easy_setopt( m_CURL, CURLOPT_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS );
#endif
#ifdef _WIN32
// We need this to use the Windows Certificate store
@@ -264,7 +263,7 @@ bool KICAD_CURL_EASY::SetTransferCallback( const TRANSFER_CALLBACK& aCallback, s
{
progress = std::make_unique<CURL_PROGRESS>( this, aCallback,
static_cast<curl_off_t>( aInterval ) );
#ifdef CURLOPT_XFERINFOFUNCTION
#if LIBCURL_VERSION_NUM >= 0x072000 // 7.32.0
setOption( CURLOPT_XFERINFOFUNCTION, xferinfo );
setOption( CURLOPT_XFERINFODATA, progress.get() );
#else
@@ -286,7 +285,7 @@ bool KICAD_CURL_EASY::SetOutputStream( const std::ostream* aOutput )
int KICAD_CURL_EASY::GetTransferTotal( uint64_t& aDownloadedBytes ) const
{
#ifdef CURLINFO_SIZE_DOWNLOAD_T
#if LIBCURL_VERSION_NUM >= 0x073700 // 7.55.0
curl_off_t dl;
int result = curl_easy_getinfo( m_CURL, CURLINFO_SIZE_DOWNLOAD_T, &dl );
aDownloadedBytes = static_cast<uint64_t>( dl );
+6 -4
View File
@@ -431,15 +431,17 @@ KIWAY_PLAYER* KIWAY::Player( FRAME_T aFrameType, bool doCreate, wxTopLevelWindow
}
catch( const IO_ERROR& ioe )
{
DisplayErrorMessage( nullptr, _( "Error loading editor." ), ioe.What() );
wxLogError( ioe.What() );
wxLogError( _( "Error loading editor." ) );
}
catch( const std::exception& e)
catch( const std::exception& e )
{
DisplayErrorMessage( nullptr, _( "Error loading editor." ), e.what() );
wxLogError( e.what() );
wxLogError( _( "Error loading editor." ) );
}
catch( ... )
{
DisplayErrorMessage( nullptr, _( "Error loading editor." ) );
wxLogError( _( "Error loading editor." ) );
}
}
+3 -1
View File
@@ -193,6 +193,8 @@ LIB_TABLE_ROW* LIB_TABLE::findRow( const wxString& aNickName, bool aCheckIfEnabl
{
cur->ensureIndex();
std::shared_lock<std::shared_mutex> lock( cur->m_nickIndexMutex );
for( const std::pair<const wxString, int>& entry : cur->m_nickIndex )
{
if( entry.first == aNickName )
@@ -303,7 +305,7 @@ bool LIB_TABLE::InsertRow( LIB_TABLE_ROW* aRow, bool doReplace )
{
ensureIndex();
std::lock_guard<std::mutex> lock( m_nickIndexMutex );
std::lock_guard<std::shared_mutex> lock( m_nickIndexMutex );
INDEX_CITER it = m_nickIndex.find( aRow->GetNickName() );
+16 -5
View File
@@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2017-2022 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2017-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
@@ -24,12 +24,16 @@ LIB_TABLE_GRID_TRICKS::LIB_TABLE_GRID_TRICKS( WX_GRID* aGrid ) : GRID_TRICKS( aG
{
}
void LIB_TABLE_GRID_TRICKS::showPopupMenu( wxMenu& menu )
{
bool showActivate = false;
bool showDeactivate = false;
LIB_TABLE_GRID* tbl = static_cast<LIB_TABLE_GRID*>( m_grid->GetTable() );
// Ensure selection parameters are up to date
getSelectedArea();
for( int row = m_sel_row_start; row < m_sel_row_start + m_sel_row_count; ++row )
{
if( tbl->GetValueAsBool( row, 0 ) )
@@ -49,10 +53,14 @@ void LIB_TABLE_GRID_TRICKS::showPopupMenu( wxMenu& menu )
menu.Append( LIB_TABLE_GRID_TRICKS_ACTIVATE_SELECTED, _( "Activate selected" ) );
if( showDeactivate )
menu.Append( LIB_TABLE_GRID_TRICKS_DEACTIVATE_SELECTED, _( "Deactivate selected" ) );
menu.AppendSeparator();
if( showActivate || showDeactivate )
menu.AppendSeparator();
GRID_TRICKS::showPopupMenu( menu );
}
void LIB_TABLE_GRID_TRICKS::doPopupSelection( wxCommandEvent& event )
{
int menu_id = event.GetId();
@@ -61,10 +69,13 @@ void LIB_TABLE_GRID_TRICKS::doPopupSelection( wxCommandEvent& event )
{
LIB_TABLE_GRID* tbl = (LIB_TABLE_GRID*) m_grid->GetTable();
bool selected_state = menu_id == LIB_TABLE_GRID_TRICKS_ACTIVATE_SELECTED;
for( int row = m_sel_row_start; row < m_sel_row_start + m_sel_row_count; ++row )
{
tbl->SetValueAsBool( row, 0, menu_id == LIB_TABLE_GRID_TRICKS_ACTIVATE_SELECTED );
}
tbl->SetValueAsBool( row, 0, selected_state );
// Ensure the new state (on/off) of the widgets is immediately shown:
m_grid->Refresh();
}
else
{
+4 -6
View File
@@ -3,7 +3,7 @@
*lib_tree_model
* Copyright (C) 2017 Chris Pavlina <pavlina.chris@gmail.com>
* Copyright (C) 2014 Henner Zeller <h.zeller@acm.org>
* Copyright (C) 2014-2019 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2014-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
@@ -24,14 +24,12 @@
#include <algorithm>
#include <eda_pattern_match.h>
#include <lib_tree_item.h>
#include <utility>
#include <pgm_base.h>
#include <string_utils.h>
// Each node gets this lowest score initially, without any matches applied.
// Matches will then increase this score depending on match quality. This way,
// an empty search string will result in all components being displayed as they
// have the minimum score. However, in that case, we avoid expanding all the
// Each node gets this lowest score initially, without any matches applied. Matches will then
// increase this score. This way, an empty search string will result in all components being
// displayed as they have the minimum score. However, in that case, we avoid expanding all the
// nodes asd the result is very unspecific.
static const unsigned kLowestDefaultScore = 1;
+69 -83
View File
@@ -3,7 +3,7 @@
*
* Copyright (C) 2017 Chris Pavlina <pavlina.chris@gmail.com>
* Copyright (C) 2014 Henner Zeller <h.zeller@acm.org>
* Copyright (C) 2014-2022 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2014-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
@@ -213,17 +213,11 @@ void LIB_TREE_MODEL_ADAPTER::UpdateSearchString( const wxString& aSearch, bool a
Thaw();
}
LIB_TREE_NODE* bestMatch = ShowResults();
const LIB_TREE_NODE* firstMatch = ShowResults();
if( !bestMatch )
bestMatch = ShowPreselect();
if( !bestMatch )
bestMatch = ShowSingleLibrary();
if( bestMatch )
if( firstMatch )
{
wxDataViewItem item = wxDataViewItem( bestMatch );
wxDataViewItem item = ToItem( firstMatch );
m_widget->Select( item );
// Make sure the *parent* item is visible. The selected item is the
@@ -269,7 +263,7 @@ void LIB_TREE_MODEL_ADAPTER::recreateColumns()
for( const wxString& colName : m_shownColumns )
{
if( !m_colNameMap.count( colName ) )
doAddColumn( colName, false );
doAddColumn( colName, colName == wxT( "Description" ) );
}
}
@@ -619,93 +613,85 @@ bool LIB_TREE_MODEL_ADAPTER::GetAttr( const wxDataViewItem& aItem,
}
void LIB_TREE_MODEL_ADAPTER::Find( LIB_TREE_NODE& aNode,
std::function<bool( const LIB_TREE_NODE* )> aFunc,
LIB_TREE_NODE** aHighScore )
void recursiveDescent( LIB_TREE_NODE& aNode, const std::function<bool( const LIB_TREE_NODE* )>& f )
{
for( std::unique_ptr<LIB_TREE_NODE>& node: aNode.m_Children )
{
if( aFunc( &*node ) )
{
if( !(*aHighScore) || node->m_Score > (*aHighScore)->m_Score )
(*aHighScore) = &*node;
}
if( !f( node.get() ) )
break;
Find( *node, aFunc, aHighScore );
recursiveDescent( *node, f );
}
}
LIB_TREE_NODE* LIB_TREE_MODEL_ADAPTER::ShowResults()
const LIB_TREE_NODE* LIB_TREE_MODEL_ADAPTER::ShowResults()
{
LIB_TREE_NODE* highScore = nullptr;
const LIB_TREE_NODE* firstMatch = nullptr;
Find( m_tree,
[]( LIB_TREE_NODE const* n )
{
// return leaf nodes with some level of matching
return n->m_Type == LIB_TREE_NODE::TYPE::LIBID && n->m_Score > 1;
},
&highScore );
if( highScore)
{
wxDataViewItem item = wxDataViewItem( highScore );
m_widget->ExpandAncestors( item );
}
return highScore;
}
LIB_TREE_NODE* LIB_TREE_MODEL_ADAPTER::ShowPreselect()
{
LIB_TREE_NODE* highScore = nullptr;
if( !m_preselect_lib_id.IsValid() )
return highScore;
Find( m_tree,
[&]( LIB_TREE_NODE const* n )
// Expand parents of leaf nodes with some level of matching
recursiveDescent( m_tree,
[&]( const LIB_TREE_NODE* n )
{
if( n->m_Type == LIB_TREE_NODE::LIBID && ( n->m_Children.empty() ||
!m_preselect_unit ) )
return m_preselect_lib_id == n->m_LibId;
else if( n->m_Type == LIB_TREE_NODE::UNIT && m_preselect_unit )
return m_preselect_lib_id == n->m_Parent->m_LibId &&
m_preselect_unit == n->m_Unit;
else
return false;
},
&highScore );
if( n->m_Type == LIB_TREE_NODE::TYPE::LIBID && n->m_Score > 1 )
{
if( !firstMatch )
firstMatch = n;
else if( n->m_Score > firstMatch->m_Score )
firstMatch = n;
if( highScore)
m_widget->ExpandAncestors( ToItem( n ) );
}
return true; // keep going to expand ancestors of all found items
} );
// If no matches, find and show the preselect node
if( !firstMatch && m_preselect_lib_id.IsValid() )
{
wxDataViewItem item = wxDataViewItem( highScore );
m_widget->ExpandAncestors( item );
recursiveDescent( m_tree,
[&]( const LIB_TREE_NODE* n )
{
if( n->m_Type == LIB_TREE_NODE::LIBID
&& ( n->m_Children.empty() || !m_preselect_unit )
&& m_preselect_lib_id == n->m_LibId )
{
firstMatch = n;
m_widget->ExpandAncestors( ToItem( n ) );
return false;
}
else if( n->m_Type == LIB_TREE_NODE::UNIT
&& ( m_preselect_unit && m_preselect_unit == n->m_Unit )
&& m_preselect_lib_id == n->m_Parent->m_LibId )
{
firstMatch = n;
m_widget->ExpandAncestors( ToItem( n ) );
return false;
}
return true;
} );
}
return highScore;
// If still no matches expand a single library if there is only one
if( !firstMatch )
{
recursiveDescent( m_tree,
[&]( const LIB_TREE_NODE* n )
{
if( n->m_Type == LIB_TREE_NODE::TYPE::LIBID
&& n->m_Parent->m_Parent->m_Children.size() == 1 )
{
firstMatch = n;
m_widget->ExpandAncestors( ToItem( n ) );
return false;
}
return true;
} );
}
return firstMatch;
}
LIB_TREE_NODE* LIB_TREE_MODEL_ADAPTER::ShowSingleLibrary()
{
LIB_TREE_NODE* highScore = nullptr;
Find( m_tree,
[]( LIB_TREE_NODE const* n )
{
return n->m_Type == LIB_TREE_NODE::TYPE::LIBID &&
n->m_Parent->m_Parent->m_Children.size() == 1;
},
&highScore );
if( highScore)
{
wxDataViewItem item = wxDataViewItem( highScore );
m_widget->ExpandAncestors( item );
}
return highScore;
}
+3 -2
View File
@@ -2,7 +2,7 @@
* This file is part of libeval, a simple math expression evaluator
*
* Copyright (C) 2017 Michael Geselbracht, mgeselbracht3@gmail.com
* Copyright (C) 2019-2022 KiCad Developers, see AUTHORS.txt for contributors.
* 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
@@ -356,10 +356,11 @@ void COMPILER::newString( const wxString& aString )
m_parseFinished = false;
}
T_TOKEN COMPILER::getToken()
{
T_TOKEN rv;
rv.value.str = nullptr;
rv.value = defaultTokenValue;
bool done = false;
+45 -1
View File
@@ -43,6 +43,7 @@
#include <wx/tooltip.h>
#include <advanced_config.h>
#include <cli/cli_names.h> // Needed for the pre wx 3.2 cli workaround
#include <common.h>
#include <config_params.h>
#include <confirm.h>
@@ -51,6 +52,7 @@
#include <eda_draw_frame.h>
#include <gestfich.h>
#include <id.h>
#include <kicad_curl/kicad_curl.h>
#include <kiplatform/policy.h>
#include <lockfile.h>
#include <menus_helpers.h>
@@ -110,7 +112,7 @@ LANGUAGE_DESCR LanguagesList[] =
{ wxLANGUAGE_SWEDISH, ID_LANGUAGE_SWEDISH, wxT( "Svenska" ), true },
// { wxLANGUAGE_VIETNAMESE, ID_LANGUAGE_VIETNAMESE, wxT( "Tiếng Việt" ), true },
// { wxLANGUAGE_TURKISH, ID_LANGUAGE_TURKISH, wxT( "Türkçe" ), true },
{ wxLANGUAGE_UKRAINIAN, ID_LANGUAGE_UKRANIAN, wxT( "Українець" ), true },
{ wxLANGUAGE_UKRAINIAN, ID_LANGUAGE_UKRANIAN, wxT( "Українська" ), true },
{ wxLANGUAGE_CHINESE_SIMPLIFIED, ID_LANGUAGE_CHINESE_SIMPLIFIED,
wxT( "简体中文" ), true },
{ wxLANGUAGE_CHINESE_TRADITIONAL, ID_LANGUAGE_CHINESE_TRADITIONAL,
@@ -150,6 +152,8 @@ PGM_BASE::~PGM_BASE()
void PGM_BASE::Destroy()
{
KICAD_CURL::Cleanup();
#ifdef KICAD_USE_SENTRY
sentry_close();
#endif
@@ -408,6 +412,8 @@ bool PGM_BASE::InitPgm( bool aHeadless, bool aSkipPyInit, bool aIsUnitTest )
// In particular, the user cache path is the most likely to be hit by startup code
PATHS::EnsureUserPathsExist();
KICAD_CURL::Init();
#ifdef KICAD_USE_SENTRY
sentryInit();
#endif
@@ -775,6 +781,26 @@ void PGM_BASE::SetLanguageIdentifier( int menu_id )
}
wxString PGM_BASE::GetLanguageTag()
{
const wxLanguageInfo* langInfo = wxLocale::GetLanguageInfo( m_language_id );
if( !langInfo )
return "";
else
{
#if wxCHECK_VERSION( 3, 1, 6 )
wxString str = langInfo->GetCanonicalWithRegion();
#else
wxString str = langInfo->CanonicalName;
#endif
str.Replace( "_", "-" );
return str;
}
}
void PGM_BASE::SetLanguagePath()
{
wxLocale::AddCatalogLookupPathPrefix( PATHS::GetLocaleDataPath() );
@@ -837,3 +863,21 @@ ENV_VAR_MAP& PGM_BASE::GetLocalEnvVariables() const
{
return GetCommonSettings()->m_Env.vars;
}
bool PGM_BASE::IsGUI()
{
if( !wxTheApp )
return false;
#if wxCHECK_VERSION( 3, 1, 6 )
return wxTheApp->IsGUI();
#else
// wxWidgets older than version 3.1.6 do not have a way to know if the app
// has a GUI or is a console application.
// So the trick is to set the App class name when starting kicad-cli, and when
// the app class name is the kicad-cli class name the app is a console app
bool run_gui = wxTheApp->GetClassName() != KICAD_CLI_APP_NAME;
return run_gui;
#endif
}
+180 -139
View File
@@ -861,145 +861,186 @@ void DXF_PLOTTER::Text( const VECTOR2I& aPos,
}
else
{
/* Emit text as a text entity. This loses formatting and shape but it's
more useful as a CAD object */
VECTOR2D origin_dev = userToDeviceCoordinates( aPos );
SetColor( aColor );
wxString cname = getDXFColorName( m_currentColor );
VECTOR2D size_dev = userToDeviceSize( aSize );
int h_code = 0, v_code = 0;
switch( aH_justify )
{
case GR_TEXT_H_ALIGN_LEFT: h_code = 0; break;
case GR_TEXT_H_ALIGN_CENTER: h_code = 1; break;
case GR_TEXT_H_ALIGN_RIGHT: h_code = 2; break;
}
switch( aV_justify )
{
case GR_TEXT_V_ALIGN_TOP: v_code = 3; break;
case GR_TEXT_V_ALIGN_CENTER: v_code = 2; break;
case GR_TEXT_V_ALIGN_BOTTOM: v_code = 1; break;
}
// Position, size, rotation and alignment
// The two alignment point usages is somewhat idiot (see the DXF ref)
// Anyway since we don't use the fit/aligned options, they're the same
fprintf( m_outputFile,
" 0\n"
"TEXT\n"
" 7\n"
"%s\n" // Text style
" 8\n"
"%s\n" // Layer name
" 10\n"
"%g\n" // First point X
" 11\n"
"%g\n" // Second point X
" 20\n"
"%g\n" // First point Y
" 21\n"
"%g\n" // Second point Y
" 40\n"
"%g\n" // Text height
" 41\n"
"%g\n" // Width factor
" 50\n"
"%g\n" // Rotation
" 51\n"
"%g\n" // Oblique angle
" 71\n"
"%d\n" // Mirror flags
" 72\n"
"%d\n" // H alignment
" 73\n"
"%d\n", // V alignment
aBold ? (aItalic ? "KICADBI" : "KICADB") : (aItalic ? "KICADI" : "KICAD"),
TO_UTF8( cname ),
origin_dev.x, origin_dev.x,
origin_dev.y, origin_dev.y,
size_dev.y, fabs( size_dev.x / size_dev.y ),
aOrient.AsDegrees(),
aItalic ? DXF_OBLIQUE_ANGLE : 0,
size_dev.x < 0 ? 2 : 0, // X mirror flag
h_code, v_code );
/* There are two issue in emitting the text:
- Our overline character (~) must be converted to the appropriate
control sequence %%O or %%o
- Text encoding in DXF is more or less unspecified since depends on
the DXF declared version, the acad version reading it *and* some
system variables to be put in the header handled only by newer acads
Also before R15 unicode simply is not supported (you need to use
bigfonts which are a massive PITA). Common denominator solution:
use Latin1 (and however someone could choke on it, anyway). Sorry
for the extended latin people. If somewant want to try fixing this
recent version seems to use UTF-8 (and not UCS2 like the rest of
Windows)
XXX Actually there is a *third* issue: older DXF formats are limited
to 255 bytes records (it was later raised to 2048); since I'm lazy
and text so long is not probable I just don't implement this rule.
If someone is interested in fixing this, you have to emit the first
partial lines with group code 3 (max 250 bytes each) and then finish
with a group code 1 (less than 250 bytes). The DXF refs explains it
in no more details...
*/
int braceNesting = 0;
int overbarDepth = -1;
fputs( " 1\n", m_outputFile );
for( unsigned int i = 0; i < aText.length(); i++ )
{
/* Here I do a bad thing: writing the output one byte at a time!
but today I'm lazy and I have no idea on how to coerce a Unicode
wxString to spit out latin1 encoded text ...
At least stdio is *supposed* to do output buffering, so there is
hope is not too slow */
wchar_t ch = aText[i];
if( ch > 255 )
{
// I can't encode this...
putc( '?', m_outputFile );
}
else
{
if( aText[i] == '~' && i+1 < aText.length() && aText[i+1] == '{' )
{
fputs( "%%o", m_outputFile );
overbarDepth = braceNesting;
// Skip the '{'
i++;
continue;
}
else if( aText[i] == '{' )
{
braceNesting++;
}
else if( aText[i] == '}' )
{
if( braceNesting > 0 )
braceNesting--;
if( braceNesting == overbarDepth )
{
fputs( "%%O", m_outputFile );
overbarDepth = -1;
continue;
}
}
putc( ch, m_outputFile );
}
}
putc( '\n', m_outputFile );
TEXT_ATTRIBUTES attrs;
attrs.m_Halign = aH_justify;
attrs.m_Valign =aV_justify;
attrs.m_StrokeWidth = aWidth;
attrs.m_Angle = aOrient;
attrs.m_Italic = aItalic;
attrs.m_Bold = aBold;
attrs.m_Mirrored = aSize.x < 0;
attrs.m_Multiline = false;
plotOneLineOfText( aPos, aColor, aText, attrs );
}
}
void DXF_PLOTTER::PlotText( const VECTOR2I& aPos, const COLOR4D& aColor,
const wxString& aText,
const TEXT_ATTRIBUTES& aAttributes,
KIFONT::FONT* aFont,
void* aData )
{
TEXT_ATTRIBUTES attrs = aAttributes;
// Fix me: see how to use DXF text mode for multiline texts
if( attrs.m_Multiline && !aText.Contains( wxT( "\n" ) ) )
attrs.m_Multiline = false; // the text has only one line.
bool processSuperSub = aText.Contains( wxT( "^{" ) ) || aText.Contains( wxT( "_{" ) );
if( m_textAsLines || containsNonAsciiChars( aText ) || attrs.m_Multiline || processSuperSub )
{
// output text as graphics.
// Perhaps multiline texts could be handled as DXF text entity
// but I do not want spend time about that (JPC)
PLOTTER::PlotText( aPos, aColor, aText, aAttributes, aFont, aData );
}
else
plotOneLineOfText( aPos, aColor, aText, attrs );
}
void DXF_PLOTTER::plotOneLineOfText( const VECTOR2I& aPos, const COLOR4D& aColor,
const wxString& aText,
const TEXT_ATTRIBUTES& aAttributes )
{
/* Emit text as a text entity. This loses formatting and shape but it's
more useful as a CAD object */
VECTOR2D origin_dev = userToDeviceCoordinates( aPos );
SetColor( aColor );
wxString cname = getDXFColorName( m_currentColor );
VECTOR2D size_dev = userToDeviceSize( aAttributes.m_Size );
int h_code = 0, v_code = 0;
switch( aAttributes.m_Halign )
{
case GR_TEXT_H_ALIGN_LEFT: h_code = 0; break;
case GR_TEXT_H_ALIGN_CENTER: h_code = 1; break;
case GR_TEXT_H_ALIGN_RIGHT: h_code = 2; break;
}
switch( aAttributes.m_Valign )
{
case GR_TEXT_V_ALIGN_TOP: v_code = 3; break;
case GR_TEXT_V_ALIGN_CENTER: v_code = 2; break;
case GR_TEXT_V_ALIGN_BOTTOM: v_code = 1; break;
}
// Position, size, rotation and alignment
// The two alignment point usages is somewhat idiot (see the DXF ref)
// Anyway since we don't use the fit/aligned options, they're the same
fprintf( m_outputFile,
" 0\n"
"TEXT\n"
" 7\n"
"%s\n" // Text style
" 8\n"
"%s\n" // Layer name
" 10\n"
"%g\n" // First point X
" 11\n"
"%g\n" // Second point X
" 20\n"
"%g\n" // First point Y
" 21\n"
"%g\n" // Second point Y
" 40\n"
"%g\n" // Text height
" 41\n"
"%g\n" // Width factor
" 50\n"
"%g\n" // Rotation
" 51\n"
"%g\n" // Oblique angle
" 71\n"
"%d\n" // Mirror flags
" 72\n"
"%d\n" // H alignment
" 73\n"
"%d\n", // V alignment
aAttributes.m_Bold ?
(aAttributes.m_Italic ? "KICADBI" : "KICADB")
: (aAttributes.m_Italic ? "KICADI" : "KICAD"), TO_UTF8( cname ),
origin_dev.x, origin_dev.x,
origin_dev.y, origin_dev.y,
size_dev.y, fabs( size_dev.x / size_dev.y ),
aAttributes.m_Angle.AsDegrees(),
aAttributes.m_Italic ? DXF_OBLIQUE_ANGLE : 0,
aAttributes.m_Mirrored ? 2 : 0, // X mirror flag
h_code, v_code );
/* There are two issue in emitting the text:
- Our overline character (~) must be converted to the appropriate
control sequence %%O or %%o
- Text encoding in DXF is more or less unspecified since depends on
the DXF declared version, the acad version reading it *and* some
system variables to be put in the header handled only by newer acads
Also before R15 unicode simply is not supported (you need to use
bigfonts which are a massive PITA). Common denominator solution:
use Latin1 (and however someone could choke on it, anyway). Sorry
for the extended latin people. If somewant want to try fixing this
recent version seems to use UTF-8 (and not UCS2 like the rest of
Windows)
XXX Actually there is a *third* issue: older DXF formats are limited
to 255 bytes records (it was later raised to 2048); since I'm lazy
and text so long is not probable I just don't implement this rule.
If someone is interested in fixing this, you have to emit the first
partial lines with group code 3 (max 250 bytes each) and then finish
with a group code 1 (less than 250 bytes). The DXF refs explains it
in no more details...
*/
int braceNesting = 0;
int overbarDepth = -1;
fputs( " 1\n", m_outputFile );
for( unsigned int i = 0; i < aText.length(); i++ )
{
/* Here I do a bad thing: writing the output one byte at a time!
but today I'm lazy and I have no idea on how to coerce a Unicode
wxString to spit out latin1 encoded text ...
At least stdio is *supposed* to do output buffering, so there is
hope is not too slow */
wchar_t ch = aText[i];
if( ch > 255 )
{
// I can't encode this...
putc( '?', m_outputFile );
}
else
{
if( aText[i] == '~' && i+1 < aText.length() && aText[i+1] == '{' )
{
fputs( "%%o", m_outputFile );
overbarDepth = braceNesting;
// Skip the '{'
i++;
continue;
}
else if( aText[i] == '{' )
{
braceNesting++;
}
else if( aText[i] == '}' )
{
if( braceNesting > 0 )
braceNesting--;
if( braceNesting == overbarDepth )
{
fputs( "%%O", m_outputFile );
overbarDepth = -1;
continue;
}
}
putc( ch, m_outputFile );
}
}
putc( '\n', m_outputFile );
}
+54 -25
View File
@@ -154,7 +154,6 @@ void GERBER_PLOTTER::SetGerberCoordinatesFormat( int aResolution, bool aUseInche
void GERBER_PLOTTER::emitDcode( const VECTOR2D& pt, int dcode )
{
fprintf( m_outputFile, "X%dY%dD%02d*\n", KiROUND( pt.x ), KiROUND( pt.y ), dcode );
}
@@ -849,11 +848,16 @@ void GERBER_PLOTTER::plotArc( const SHAPE_ARC& aArc, bool aPlotInRegion )
LineTo( start );
VECTOR2D devEnd = userToDeviceCoordinates( end );
VECTOR2D devCenter = userToDeviceCoordinates( center - start );
// devRelCenter is the position on arc center relative to the arc start, in Gerber coord.
// Warning: it is **not** userToDeviceCoordinates( center - start ) when the plotter
// has an offset.
VECTOR2D devRelCenter = userToDeviceCoordinates( center ) - userToDeviceCoordinates( start );
// We need to know if the arc is CW or CCW in device coordinates, so build this arc.
SHAPE_ARC deviceArc( userToDeviceCoordinates( start ),
userToDeviceCoordinates( aArc.GetArcMid() ), devEnd, 0 );
userToDeviceCoordinates( aArc.GetArcMid() ),
devEnd, 0 );
fprintf( m_outputFile, "G75*\n" ); // Multiquadrant (360 degrees) mode
@@ -864,7 +868,7 @@ void GERBER_PLOTTER::plotArc( const SHAPE_ARC& aArc, bool aPlotInRegion )
fprintf( m_outputFile, "X%dY%dI%dJ%dD01*\n",
KiROUND( devEnd.x ), KiROUND( devEnd.y ),
KiROUND( devCenter.x ), KiROUND( devCenter.y ) );
KiROUND( devRelCenter.x ), KiROUND( devRelCenter.y ) );
fprintf( m_outputFile, "G01*\n" ); // Back to linear interpolate (perhaps useless here).
}
@@ -885,7 +889,8 @@ void GERBER_PLOTTER::plotArc( const VECTOR2I& aCenter, const EDA_ANGLE& aStartAn
end.x = aCenter.x + KiROUND( aRadius * aEndAngle.Cos() );
end.y = aCenter.y - KiROUND( aRadius * aEndAngle.Sin() );
VECTOR2D devEnd = userToDeviceCoordinates( end );
VECTOR2D devCenter = userToDeviceCoordinates( aCenter ) - userToDeviceCoordinates( start );
// devRelCenter is the position on arc center relative to the arc start, in Gerber coord.
VECTOR2D devRelCenter = userToDeviceCoordinates( aCenter ) - userToDeviceCoordinates( start );
fprintf( m_outputFile, "G75*\n" ); // Multiquadrant (360 degrees) mode
@@ -896,24 +901,22 @@ void GERBER_PLOTTER::plotArc( const VECTOR2I& aCenter, const EDA_ANGLE& aStartAn
fprintf( m_outputFile, "X%dY%dI%dJ%dD01*\n",
KiROUND( devEnd.x ), KiROUND( devEnd.y ),
KiROUND( devCenter.x ), KiROUND( devCenter.y ) );
KiROUND( devRelCenter.x ), KiROUND( devRelCenter.y ) );
fprintf( m_outputFile, "G01*\n" ); // Back to linear interpolate (perhaps useless here).
}
void GERBER_PLOTTER::PlotGerberRegion( const SHAPE_LINE_CHAIN& aPoly, void* aData )
void GERBER_PLOTTER::PlotGerberRegion( const SHAPE_LINE_CHAIN& aPoly, GBR_METADATA* aGbrMetadata )
{
if( aPoly.PointCount() <= 2 )
return;
GBR_METADATA* gbr_metadata = static_cast<GBR_METADATA*>( aData );
bool clearTA_AperFunction = false; // true if a TA.AperFunction is used
if( gbr_metadata )
if( aGbrMetadata )
{
std::string attrib = gbr_metadata->m_ApertureMetadata.FormatAttribute( !m_useX2format );
std::string attrib = aGbrMetadata->m_ApertureMetadata.FormatAttribute( !m_useX2format );
if( !attrib.empty() )
{
@@ -922,7 +925,7 @@ void GERBER_PLOTTER::PlotGerberRegion( const SHAPE_LINE_CHAIN& aPoly, void* aDat
}
}
PlotPoly( aPoly, FILL_T::FILLED_SHAPE, 0 , gbr_metadata );
PlotPoly( aPoly, FILL_T::FILLED_SHAPE, 0 , aGbrMetadata );
// Clear the TA attribute, to avoid the next item to inherit it:
if( clearTA_AperFunction )
@@ -939,18 +942,17 @@ void GERBER_PLOTTER::PlotGerberRegion( const SHAPE_LINE_CHAIN& aPoly, void* aDat
}
void GERBER_PLOTTER::PlotGerberRegion( const std::vector<VECTOR2I>& aCornerList, void* aData )
void GERBER_PLOTTER::PlotGerberRegion( const std::vector<VECTOR2I>& aCornerList,
GBR_METADATA* aGbrMetadata )
{
if( aCornerList.size() <= 2 )
return;
GBR_METADATA* gbr_metadata = static_cast<GBR_METADATA*>( aData );
bool clearTA_AperFunction = false; // true if a TA.AperFunction is used
if( gbr_metadata )
if( aGbrMetadata )
{
std::string attrib = gbr_metadata->m_ApertureMetadata.FormatAttribute( !m_useX2format );
std::string attrib = aGbrMetadata->m_ApertureMetadata.FormatAttribute( !m_useX2format );
if( !attrib.empty() )
{
@@ -959,7 +961,7 @@ void GERBER_PLOTTER::PlotGerberRegion( const std::vector<VECTOR2I>& aCornerList,
}
}
PlotPoly( aCornerList, FILL_T::FILLED_SHAPE, 0, gbr_metadata );
PlotPoly( aCornerList, FILL_T::FILLED_SHAPE, 0, aGbrMetadata );
// Clear the TA attribute, to avoid the next item to inherit it:
if( clearTA_AperFunction )
@@ -976,6 +978,19 @@ void GERBER_PLOTTER::PlotGerberRegion( const std::vector<VECTOR2I>& aCornerList,
}
void GERBER_PLOTTER::PlotPolyAsRegion( const SHAPE_LINE_CHAIN& aPoly, FILL_T aFill,
int aWidth, GBR_METADATA* aGbrMetadata )
{
// plot a filled polygon using Gerber region, therefore adding X2 attributes
// to the solid polygon
if( aWidth )
PlotPoly( aPoly, FILL_T::NO_FILL, aWidth, aGbrMetadata );
if( aFill != FILL_T::NO_FILL )
PlotGerberRegion( aPoly, aGbrMetadata );
}
void GERBER_PLOTTER::PlotPoly( const SHAPE_LINE_CHAIN& aPoly, FILL_T aFill, int aWidth,
void* aData )
{
@@ -1011,7 +1026,7 @@ void GERBER_PLOTTER::PlotPoly( const SHAPE_LINE_CHAIN& aPoly, FILL_T aFill, int
{
const SHAPE_ARC& arc = aPoly.Arc( arcindex );
plotArc( arc, ii > 0 );
plotArc( arc, true );
// skip points on arcs, since we plot the arc itself
while( ii+1 < aPoly.PointCount() && arcindex == aPoly.ArcIndex( ii+1 ) )
@@ -1045,7 +1060,7 @@ void GERBER_PLOTTER::PlotPoly( const SHAPE_LINE_CHAIN& aPoly, FILL_T aFill, int
{
const SHAPE_ARC& arc = aPoly.Arc( arcindex );
plotArc( arc, ii > 0 );
plotArc( arc, true );
// skip points on arcs, since we plot the arc itself
while( ii+1 < aPoly.PointCount() && arcindex == aPoly.ArcIndex( ii+1 ) )
@@ -1322,7 +1337,7 @@ void GERBER_PLOTTER::FlashPadOval( const VECTOR2I& aPos, const VECTOR2I& aSize,
if( orient.IsCardinal90() )
std::swap( size.x, size.y );
VECTOR2I pos_device = userToDeviceCoordinates( aPos );
VECTOR2D pos_device = userToDeviceCoordinates( aPos );
int aperture_attrib = gbr_metadata ? gbr_metadata->GetApertureAttrib() : 0;
selectAperture( size, 0, ANGLE_0, APERTURE::AT_OVAL, aperture_attrib );
@@ -1353,7 +1368,7 @@ void GERBER_PLOTTER::FlashPadOval( const VECTOR2I& aPos, const VECTOR2I& aSize,
orient -= ANGLE_180;
}
VECTOR2I pos_device = userToDeviceCoordinates( aPos );
VECTOR2D pos_device = userToDeviceCoordinates( aPos );
int aperture_attrib = gbr_metadata ? gbr_metadata->GetApertureAttrib() : 0;
selectAperture( size, 0, orient, APERTURE::AM_ROTATED_OVAL, aperture_attrib );
@@ -1416,7 +1431,7 @@ void GERBER_PLOTTER::FlashPadRect( const VECTOR2I& pos, const VECTOR2I& aSize,
}
else
{
VECTOR2I pos_device = userToDeviceCoordinates( pos );
VECTOR2D pos_device = userToDeviceCoordinates( pos );
int aperture_attrib = gbr_metadata ? gbr_metadata->GetApertureAttrib() : 0;
selectAperture( size, 0, ANGLE_0, APERTURE::AT_RECT, aperture_attrib );
@@ -1433,7 +1448,7 @@ void GERBER_PLOTTER::FlashPadRect( const VECTOR2I& pos, const VECTOR2I& aSize,
{
m_hasApertureRotRect = true;
VECTOR2I pos_device = userToDeviceCoordinates( pos );
VECTOR2D pos_device = userToDeviceCoordinates( pos );
int aperture_attrib = gbr_metadata ? gbr_metadata->GetApertureAttrib() : 0;
selectAperture( size, 0, aOrient, APERTURE::AM_ROT_RECT, aperture_attrib );
@@ -1755,7 +1770,7 @@ void GERBER_PLOTTER::FlashPadChamferRoundRect( const VECTOR2I& aShapePos, const
if( aData )
gbr_metadata = *static_cast<GBR_METADATA*>( aData );
VECTOR2I pos_device = userToDeviceCoordinates( aShapePos );
VECTOR2D pos_device = userToDeviceCoordinates( aShapePos );
SHAPE_POLY_SET outline;
std::vector<VECTOR2I> cornerList;
@@ -1994,6 +2009,20 @@ void GERBER_PLOTTER::Text( const VECTOR2I& aPos,
}
void GERBER_PLOTTER::PlotText( const VECTOR2I& aPos, const COLOR4D& aColor,
const wxString& aText,
const TEXT_ATTRIBUTES& aAttributes,
KIFONT::FONT* aFont,
void* aData )
{
GBR_METADATA* gbr_metadata = static_cast<GBR_METADATA*>( aData );
if( gbr_metadata )
formatNetAttribute( &gbr_metadata->m_NetlistMetadata );
PLOTTER::PlotText( aPos, aColor, aText, aAttributes, aFont, aData );
}
void GERBER_PLOTTER::SetLayerPolarity( bool aPositive )
{
if( aPositive )
+35 -8
View File
@@ -513,10 +513,11 @@ void PDF_PLOTTER::PlotImage( const wxImage& aImage, const VECTOR2I& aPos, double
if( alpha < 0xFF )
{
float a = 1.0 - ( (float) alpha / 255.0 );
r = ( int )( r + ( a * 0xFF ) ) & 0xFF;
g = ( int )( g + ( a * 0xFF ) ) & 0xFF;
b = ( int )( b + ( a * 0xFF ) ) & 0xFF;
float d = alpha / 255.0;
float a = 1.0 - d;
r = std::min( KiROUND( r * d + ( a * 0xFF ) ), 0xFF );
g = std::min( KiROUND( g * d + ( a * 0xFF ) ), 0xFF );
b = std::min( KiROUND( b * d + ( a * 0xFF ) ), 0xFF );
}
}
@@ -1376,7 +1377,9 @@ void PDF_PLOTTER::Text( const VECTOR2I& aPos,
double ctm_a, ctm_b, ctm_c, ctm_d, ctm_e, ctm_f;
double wideningFactor, heightFactor;
computeTextParameters( aPos, aText, aOrient, aSize, m_plotMirror, aH_justify,
VECTOR2I t_size( std::abs( aSize.x ), std::abs( aSize.y ) );
computeTextParameters( aPos, aText, aOrient, t_size, m_plotMirror, aH_justify,
aV_justify, aWidth, aItalic, aBold, &wideningFactor, &ctm_a,
&ctm_b, &ctm_c, &ctm_d, &ctm_e, &ctm_f, &heightFactor );
@@ -1389,7 +1392,7 @@ void PDF_PLOTTER::Text( const VECTOR2I& aPos,
if( !aFont )
aFont = KIFONT::FONT::GetFont();
VECTOR2I full_box( aFont->StringBoundaryLimits( aText, aSize, aWidth, aBold, aItalic ) );
VECTOR2I full_box( aFont->StringBoundaryLimits( aText, t_size, aWidth, aBold, aItalic ) );
VECTOR2I box_x( full_box.x, 0 );
VECTOR2I box_y( 0, full_box.y );
@@ -1410,13 +1413,13 @@ void PDF_PLOTTER::Text( const VECTOR2I& aPos,
{
wxString word = str_tok.GetNextToken();
computeTextParameters( pos, word, aOrient, aSize, m_plotMirror, GR_TEXT_H_ALIGN_LEFT,
computeTextParameters( pos, word, aOrient, t_size, m_plotMirror, GR_TEXT_H_ALIGN_LEFT,
GR_TEXT_V_ALIGN_BOTTOM, aWidth, aItalic, aBold, &wideningFactor, &ctm_a,
&ctm_b, &ctm_c, &ctm_d, &ctm_e, &ctm_f, &heightFactor );
// Extract the changed width and rotate by the orientation to get the offset for the
// next word
VECTOR2I bbox( aFont->StringBoundaryLimits( word, aSize, aWidth, aBold, aItalic ).x, 0 );
VECTOR2I bbox( aFont->StringBoundaryLimits( word, t_size, aWidth, aBold, aItalic ).x, 0 );
RotatePoint( bbox, aOrient );
pos += bbox;
@@ -1444,6 +1447,30 @@ void PDF_PLOTTER::Text( const VECTOR2I& aPos,
}
void PDF_PLOTTER::PlotText( const VECTOR2I& aPos, const COLOR4D& aColor,
const wxString& aText,
const TEXT_ATTRIBUTES& aAttributes,
KIFONT::FONT* aFont,
void* aData )
{
VECTOR2I size = aAttributes.m_Size;
// PDF files do not like 0 sized texts which create broken files.
if( size.x == 0 || size.y == 0 )
return;
if( aAttributes.m_Mirrored )
size.x = -size.x;
PDF_PLOTTER::Text( aPos, aColor, aText, aAttributes.m_Angle, size,
aAttributes.m_Halign, aAttributes.m_Valign,
aAttributes.m_StrokeWidth,
aAttributes.m_Italic, aAttributes.m_Bold,
aAttributes.m_Multiline,
aFont, aData );
}
void PDF_PLOTTER::HyperlinkBox( const BOX2I& aBox, const wxString& aDestinationURL )
{
m_hyperlinksInPage.push_back( std::make_pair( aBox, aDestinationURL ) );
+22
View File
@@ -967,6 +967,28 @@ void PS_PLOTTER::Text( const VECTOR2I& aPos,
}
void PS_PLOTTER::PlotText( const VECTOR2I& aPos,
const COLOR4D& aColor,
const wxString& aText,
const TEXT_ATTRIBUTES& aAttributes,
KIFONT::FONT* aFont,
void* aData )
{
SetCurrentLineWidth( aAttributes.m_StrokeWidth );
SetColor( aColor );
// Draw the hidden postscript text (if requested)
if( m_textMode == PLOT_TEXT_MODE::PHANTOM )
{
std::string ps_test = encodeStringForPlotter( aText );
VECTOR2D pos_dev = userToDeviceCoordinates( aPos );
fprintf( m_outputFile, "%s %g %g phantomshow\n", ps_test.c_str(), pos_dev.x, pos_dev.y );
}
PLOTTER::PlotText( aPos, aColor, aText, aAttributes, aFont, aData );
}
/**
* Character widths for Helvetica
*/
+27 -1
View File
@@ -633,7 +633,13 @@ void SVG_PLOTTER::PlotImage( const wxImage& aImage, const VECTOR2I& aPos, double
{
wxMemoryOutputStream img_stream;
aImage.SaveFile( img_stream, wxBITMAP_TYPE_PNG );
if( m_colorMode )
aImage.SaveFile( img_stream, wxBITMAP_TYPE_PNG );
else // Plot in B&W
{
wxImage image = aImage.ConvertToGreyscale();
image.SaveFile( img_stream, wxBITMAP_TYPE_PNG );
}
size_t input_len = img_stream.GetOutputStreamBuffer()->GetBufferSize();
std::vector<uint8_t> buffer( input_len );
std::vector<uint8_t> encoded;
@@ -847,3 +853,23 @@ void SVG_PLOTTER::Text( const VECTOR2I& aPos,
fputs( "</g>", m_outputFile );
}
void SVG_PLOTTER::PlotText( const VECTOR2I& aPos, const COLOR4D& aColor,
const wxString& aText,
const TEXT_ATTRIBUTES& aAttributes,
KIFONT::FONT* aFont,
void* aData )
{
VECTOR2I size = aAttributes.m_Size;
if( aAttributes.m_Mirrored )
size.x = -size.x;
SVG_PLOTTER::Text( aPos, aColor, aText, aAttributes.m_Angle, size,
aAttributes.m_Halign, aAttributes.m_Valign,
aAttributes.m_StrokeWidth,
aAttributes.m_Italic, aAttributes.m_Bold,
aAttributes.m_Multiline,
aFont, aData );
}
+4 -4
View File
@@ -139,10 +139,10 @@ void PlotDrawingSheet( PLOTTER* plotter, const PROJECT* aProject, const TITLE_BL
int penWidth = std::max( text->GetEffectiveTextPenWidth(), defaultPenWidth );
plotter->Text( text->GetTextPos(), color, text->GetShownText(), text->GetTextAngle(),
text->GetTextSize(), text->GetHorizJustify(), text->GetVertJustify(),
penWidth, text->IsItalic(), text->IsBold(), text->IsMultilineAllowed(),
font );
plotter->Text( text->GetTextPos(), color, text->GetShownText( true ),
text->GetTextAngle(), text->GetTextSize(), text->GetHorizJustify(),
text->GetVertJustify(), penWidth, text->IsItalic(), text->IsBold(),
text->IsMultilineAllowed(), font );
}
break;
+50 -18
View File
@@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2017-2022 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2017-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
@@ -694,23 +694,6 @@ void PLOTTER::PlotPoly( const SHAPE_LINE_CHAIN& aCornerList, FILL_T aFill, int a
}
/**
* Same as GRText, but plot graphic text instead of draw it.
*
* @param aPos is the text position (according to aH_justify, aV_justify).
* @param aColor is the text color.
* @param aText is the text to draw.
* @param aOrient is the angle.
* @param aSize is the text size (size.x or size.y can be < 0 for mirrored texts).
* @param aH_justify is the horizontal justification (Left, center, right).
* @param aV_justify is the vertical justification (bottom, center, top).
* @param aPenWidth is the line width (if = 0, use plot default line width).
* @param aItalic is the true to simulate an italic font.
* @param aBold use true to use a bold font Useful only with default width value (aPenWidth = 0).
* @param aMultilineAllowed use true to plot text as multiline, otherwise single line.
* @param aData is a parameter used by some plotters in SetCurrentLineWidth(),
* not directly used here.
*/
void PLOTTER::Text( const VECTOR2I& aPos,
const COLOR4D& aColor,
const wxString& aText,
@@ -759,6 +742,55 @@ void PLOTTER::Text( const VECTOR2I& aPos,
attributes.m_Valign = aV_justify;
attributes.m_Size = aSize;
// if Size.x is < 0, the text is mirrored (we have no other param to know a text is mirrored)
if( attributes.m_Size.x < 0 )
{
attributes.m_Size.x = -attributes.m_Size.x;
attributes.m_Mirrored = true;
}
if( !aFont )
aFont = KIFONT::FONT::GetFont();
aFont->Draw( &callback_gal, aText, aPos, attributes );
}
void PLOTTER::PlotText( const VECTOR2I& aPos, const COLOR4D& aColor,
const wxString& aText,
const TEXT_ATTRIBUTES& aAttributes,
KIFONT::FONT* aFont,
void* aData )
{
KIGFX::GAL_DISPLAY_OPTIONS empty_opts;
TEXT_ATTRIBUTES attributes = aAttributes;
int penWidth = attributes.m_StrokeWidth;
SetColor( aColor );
SetCurrentLineWidth( penWidth, aData );
if( penWidth == 0 && attributes.m_Bold ) // Use default values if aPenWidth == 0
penWidth = GetPenSizeForBold( std::min( attributes.m_Size.x, attributes.m_Size.y ) );
if( penWidth < 0 )
penWidth = -penWidth;
attributes.m_StrokeWidth = penWidth;
CALLBACK_GAL callback_gal( empty_opts,
// Stroke callback
[&]( const VECTOR2I& aPt1, const VECTOR2I& aPt2 )
{
MoveTo( aPt1 );
LineTo( aPt2 );
PenFinish();
},
// Polygon callback
[&]( const SHAPE_LINE_CHAIN& aPoly )
{
PlotPoly( aPoly, FILL_T::FILLED_SHAPE, 0, aData );
} );
if( !aFont )
aFont = KIFONT::FONT::GetFont();
@@ -193,7 +193,7 @@ void CADSTAR_ARCHIVE_PARSER::LINECODE::Parse( XNODE* aNode, PARSER_CONTEXT* aCon
XNODE* cNode = aNode->GetChildren();
if( cNode->GetName() != wxT( "STYLE" ) )
if( !cNode || cNode->GetName() != wxT( "STYLE" ) )
THROW_UNKNOWN_NODE_IO_ERROR( cNode->GetName(), wxString::Format( "LINECODE -> %s", Name ) );
wxString styleStr = GetXmlAttributeIDString( cNode, 0 );
@@ -486,18 +486,28 @@ void CADSTAR_ARCHIVE_PARSER::VERTEX::AppendToChain( SHAPE_LINE_CHAIN* aChainToAp
const std::function<VECTOR2I( const VECTOR2I& )> aCadstarToKicadPointCallback,
double aAccuracy ) const
{
VECTOR2I endPoint = aCadstarToKicadPointCallback( End );
if( Type == VERTEX_TYPE::POINT )
{
aChainToAppendTo->Append( endPoint );
aChainToAppendTo->Append( aCadstarToKicadPointCallback( End ) );
return;
}
wxCHECK_MSG( aChainToAppendTo->PointCount() > 0, /*void*/,
"Can't append an arc to vertex to an empty chain" );
VECTOR2I startPoint = aChainToAppendTo->GetPoint( -1 );
aChainToAppendTo->Append( BuildArc( aChainToAppendTo->GetPoint( -1 ), aCadstarToKicadPointCallback),
aAccuracy );
}
SHAPE_ARC CADSTAR_ARCHIVE_PARSER::VERTEX::BuildArc( const VECTOR2I& aPrevPoint,
const std::function<VECTOR2I( const VECTOR2I& )> aCadstarToKicadPointCallback ) const
{
wxCHECK_MSG( Type != VERTEX_TYPE::POINT, SHAPE_ARC(),
"Can't build an arc for a straight segment!" );
VECTOR2I startPoint = aPrevPoint;
VECTOR2I endPoint = aCadstarToKicadPointCallback( End );
VECTOR2I centerPoint;
if( Type == VERTEX_TYPE::ANTICLOCKWISE_SEMICIRCLE || Type == VERTEX_TYPE::CLOCKWISE_SEMICIRCLE )
@@ -516,9 +526,8 @@ void CADSTAR_ARCHIVE_PARSER::VERTEX::AppendToChain( SHAPE_LINE_CHAIN* aChainToAp
clockwise = !clockwise;
SHAPE_ARC arc;
arc.ConstructFromStartEndCenter( startPoint, endPoint, centerPoint, clockwise );
aChainToAppendTo->Append( arc, aAccuracy );
return arc.ConstructFromStartEndCenter( startPoint, endPoint, centerPoint, clockwise );
}
@@ -2419,7 +2428,9 @@ XNODE* CADSTAR_ARCHIVE_PARSER::LoadArchiveFile( const wxString& aFileName,
const wxString& aFileTypeIdentifier, PROGRESS_REPORTER* aProgressReporter )
{
KEYWORD emptyKeywords[1] = {};
XNODE * iNode = nullptr, *cNode = nullptr;
XNODE* rootNode = nullptr;
XNODE* cNode = nullptr;
XNODE* iNode = nullptr;
int tok;
bool cadstarFileCheckDone = false;
wxString str;
@@ -2451,7 +2462,10 @@ XNODE* CADSTAR_ARCHIVE_PARSER::LoadArchiveFile( const wxString& aFileName,
if( aProgressReporter && ( currentProgress() - previousReportedProgress ) > 0.01 )
{
if( !aProgressReporter->KeepRefreshing() )
{
delete rootNode;
THROW_IO_ERROR( _( "File import cancelled by user." ) );
}
aProgressReporter->SetCurrentProgress( currentProgress() );
previousReportedProgress = currentProgress();
@@ -2467,6 +2481,7 @@ XNODE* CADSTAR_ARCHIVE_PARSER::LoadArchiveFile( const wxString& aFileName,
else
{
//too many closing brackets
delete rootNode;
THROW_IO_ERROR( _( "The selected file is not valid or might be corrupt!" ) );
}
}
@@ -2476,6 +2491,9 @@ XNODE* CADSTAR_ARCHIVE_PARSER::LoadArchiveFile( const wxString& aFileName,
str = wxString( lexer.CurText(), *conv );
cNode = new XNODE( wxXML_ELEMENT_NODE, str );
if( !rootNode )
rootNode = cNode;
if( iNode )
{
//we will add it as attribute as well as child node
@@ -2485,7 +2503,10 @@ XNODE* CADSTAR_ARCHIVE_PARSER::LoadArchiveFile( const wxString& aFileName,
else if( !cadstarFileCheckDone )
{
if( cNode->GetName() != aFileTypeIdentifier )
{
delete rootNode;
THROW_IO_ERROR( _( "The selected file is not valid or might be corrupt!" ) );
}
cadstarFileCheckDone = true;
}
@@ -2501,19 +2522,28 @@ XNODE* CADSTAR_ARCHIVE_PARSER::LoadArchiveFile( const wxString& aFileName,
else
{
//not enough closing brackets
delete rootNode;
THROW_IO_ERROR( _( "The selected file is not valid or might be corrupt!" ) );
}
}
// Not enough closing brackets
if( iNode != nullptr )
{
delete rootNode;
THROW_IO_ERROR( _( "The selected file is not valid or might be corrupt!" ) );
}
// Throw if no data was parsed
if( cNode )
return cNode;
if( rootNode )
{
return rootNode;
}
else
{
delete rootNode;
THROW_IO_ERROR( _( "The selected file is not valid or might be corrupt!" ) );
}
return nullptr;
}
@@ -83,6 +83,7 @@ class wxXmlAttribute;
class PROGRESS_REPORTER;
class SHAPE_LINE_CHAIN;
class SHAPE_POLY_SET;
class SHAPE_ARC;
/**
* @brief Helper functions and common structures for CADSTAR PCB and Schematic archive files.
@@ -92,6 +93,8 @@ class CADSTAR_ARCHIVE_PARSER
public:
CADSTAR_ARCHIVE_PARSER() { m_progressReporter = nullptr; }
virtual ~CADSTAR_ARCHIVE_PARSER() {}
typedef wxString LINECODE_ID;
typedef wxString HATCHCODE_ID;
@@ -451,6 +454,10 @@ public:
void AppendToChain( SHAPE_LINE_CHAIN* aChainToAppendTo,
const std::function<VECTOR2I( const VECTOR2I& )> aCadstarToKicadPointCallback,
double aAccuracy ) const;
SHAPE_ARC BuildArc( const VECTOR2I& aPrevPoint,
const std::function<VECTOR2I( const VECTOR2I& )>
aCadstarToKicadPointCallback ) const;
};
/**
+26 -19
View File
@@ -49,7 +49,7 @@ wxString escapeName( const wxString& aNetName )
wxString interpretText( const wxString& aText )
{
wxString token = aText.Upper();
wxString token = aText;
if( substituteVariable( &token ) )
return token;
@@ -116,25 +116,32 @@ wxString interpretText( const wxString& aText )
bool substituteVariable( wxString* aText )
{
if ( *aText == wxT( ">NAME" ) ) *aText = wxT( "${REFERENCE}" );
else if( *aText == wxT( ">VALUE" ) ) *aText = wxT( "${VALUE}" );
else if( *aText == wxT( ">PART" ) ) *aText = wxT( "${REFERENCE}" );
else if( *aText == wxT( ">GATE" ) ) *aText = wxT( "${UNIT}" );
else if( *aText == wxT( ">MODULE" ) ) *aText = wxT( "${FOOTPRINT_NAME}" );
else if( *aText == wxT( ">SHEETNR" ) ) *aText = wxT( "${#}" );
else if( *aText == wxT( ">SHEETS" ) ) *aText = wxT( "${##}" );
else if( *aText == wxT( ">SHEET" ) ) *aText = wxT( "${#}/${##}" );
else if( *aText == wxT( ">SHEETNR_TOTAL" ) ) *aText = wxT( "${#}" );
else if( *aText == wxT( ">SHEETS_TOTAL" ) ) *aText = wxT( "${##}" );
else if( *aText == wxT( ">SHEET_TOTAL" ) ) *aText = wxT( "${#}/${##}" );
else if( *aText == wxT( ">SHEET_HEADLINE" ) ) *aText = wxT( "${SHEETNAME}" );
else if( *aText == wxT( ">ASSEMBLY_VARIANT" ) ) *aText = wxT( "${ASSEMBLY_VARIANT}" );
else if( *aText == wxT( ">DRAWING_NAME" ) ) *aText = wxT( "${PROJECTNAME}" );
else if( *aText == wxT( ">LAST_DATE_TIME" ) ) *aText = wxT( "${CURRENT_DATE}" );
else if( *aText == wxT( ">PLOT_DATE_TIME" ) ) *aText = wxT( "${CURRENT_DATE}" );
else return false;
if( aText->StartsWith( '>' ) && aText->AfterFirst( ' ' ).IsEmpty() )
{
wxString token = aText->Upper();
return true;
if ( token == wxT( ">NAME" ) ) *aText = wxT( "${REFERENCE}" );
else if( token == wxT( ">VALUE" ) ) *aText = wxT( "${VALUE}" );
else if( token == wxT( ">PART" ) ) *aText = wxT( "${REFERENCE}" );
else if( token == wxT( ">GATE" ) ) *aText = wxT( "${UNIT}" );
else if( token == wxT( ">MODULE" ) ) *aText = wxT( "${FOOTPRINT_NAME}" );
else if( token == wxT( ">SHEETNR" ) ) *aText = wxT( "${#}" );
else if( token == wxT( ">SHEETS" ) ) *aText = wxT( "${##}" );
else if( token == wxT( ">SHEET" ) ) *aText = wxT( "${#}/${##}" );
else if( token == wxT( ">SHEETNR_TOTAL" ) ) *aText = wxT( "${#}" );
else if( token == wxT( ">SHEETS_TOTAL" ) ) *aText = wxT( "${##}" );
else if( token == wxT( ">SHEET_TOTAL" ) ) *aText = wxT( "${#}/${##}" );
else if( token == wxT( ">SHEET_HEADLINE" ) ) *aText = wxT( "${SHEETNAME}" );
else if( token == wxT( ">ASSEMBLY_VARIANT" ) ) *aText = wxT( "${ASSEMBLY_VARIANT}" );
else if( token == wxT( ">DRAWING_NAME" ) ) *aText = wxT( "${PROJECTNAME}" );
else if( token == wxT( ">LAST_DATE_TIME" ) ) *aText = wxT( "${CURRENT_DATE}" );
else if( token == wxT( ">PLOT_DATE_TIME" ) ) *aText = wxT( "${CURRENT_DATE}" );
else *aText = wxString::Format( wxS( "${%s}" ), aText->Mid( 1 ).Trim() );
return true;
}
return false;
}
-1
View File
@@ -47,7 +47,6 @@ struct EPART;
struct ETEXT;
typedef std::unordered_map<wxString, wxXmlNode*> NODE_MAP;
typedef std::map<wxString, FOOTPRINT*> FOOTPRINT_MAP;
typedef std::map<wxString, EINSTANCE*> EINSTANCE_MAP;
typedef std::map<wxString, std::unique_ptr<EPART>> EPART_MAP;
+2 -5
View File
@@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2020 CERN
* Copyright (C) 2021-2022 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2021-2023 KiCad Developers, see AUTHORS.txt for contributors.
* @author Jon Evans <jon@craftyjon.com>
*
* This program is free software: you can redistribute it and/or modify it
@@ -393,10 +393,7 @@ std::shared_ptr<NETCLASS> NET_SETTINGS::GetEffectiveNetClass( const wxString& aN
for( const auto& [ matcher, netclassName ] : m_NetClassPatternAssignments )
{
int matches;
int offset;
if( matcher->Find( aNetName, matches, offset ) && offset == 0 )
if( matcher->StartsWith( aNetName ) )
return getNetclass( netclassName );
}
@@ -210,6 +210,8 @@ PROJECT_LOCAL_SETTINGS::PROJECT_LOCAL_SETTINGS( PROJECT* aProject, const wxStrin
return;
}
m_files.clear();
for( const nlohmann::json& file : aVal )
{
PROJECT_FILE_STATE fileState;
+5
View File
@@ -73,9 +73,14 @@ wxPGWindowList PG_UNIT_EDITOR::CreateControls( wxPropertyGrid* aPropGrid, wxPGPr
m_unitBinder->SetUnits( m_frame->GetUserUnits() );
if( PGPROPERTY_DISTANCE* prop = dynamic_cast<PGPROPERTY_DISTANCE*>( aProperty ) )
{
m_unitBinder->SetCoordType( prop->CoordType() );
}
else if( dynamic_cast<PGPROPERTY_ANGLE*>( aProperty ) != nullptr )
{
m_unitBinder->SetCoordType( ORIGIN_TRANSFORMS::NOT_A_COORD );
m_unitBinder->SetUnits( EDA_UNITS::DEGREES );
}
UpdateControl( aProperty, win );
+5 -4
View File
@@ -130,7 +130,7 @@ const void* PROPERTY_MANAGER::TypeCast( const void* aSource, TYPE_ID aBase, TYPE
}
void PROPERTY_MANAGER::AddProperty( PROPERTY_BASE* aProperty, const wxString& aGroup )
PROPERTY_BASE& PROPERTY_MANAGER::AddProperty( PROPERTY_BASE* aProperty, const wxString& aGroup )
{
const wxString& name = aProperty->Name();
TYPE_ID hash = aProperty->OwnerHash();
@@ -147,15 +147,16 @@ void PROPERTY_MANAGER::AddProperty( PROPERTY_BASE* aProperty, const wxString& aG
}
m_dirty = true;
return *aProperty;
}
void PROPERTY_MANAGER::ReplaceProperty( size_t aBase, const wxString& aName, PROPERTY_BASE* aNew,
const wxString& aGroup )
PROPERTY_BASE& PROPERTY_MANAGER::ReplaceProperty( size_t aBase, const wxString& aName,
PROPERTY_BASE* aNew, const wxString& aGroup )
{
CLASS_DESC& classDesc = getClass( aNew->OwnerHash() );
classDesc.m_replaced.insert( std::make_pair( aBase, aName ) );
AddProperty( aNew, aGroup );
return AddProperty( aNew, aGroup );
}

Some files were not shown because too many files have changed in this diff Show More