Compare commits

...

346 Commits

Author SHA1 Message Date
Wayne Stambaugh 19d3e041be Tag stable version 8.0.8. 2025-01-11 12:20:18 -05:00
Alex Shvartzkop 9228a6cd09 Update translations 2025-01-11 20:16:28 +03:00
dsa-t 582377e86f Translated using Weblate (Portuguese (Brazil))
Currently translated at 100.0% (9206 of 9206 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/pt_BR/
2025-01-11 18:15:51 +01:00
dsa-t f359ca38d0 Translated using Weblate (Japanese)
Currently translated at 100.0% (9206 of 9206 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/ja/
2025-01-11 18:15:50 +01:00
dsa-t 0108e8f56c Translated using Weblate (Bulgarian)
Currently translated at 7.7% (718 of 9206 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/bg/
2025-01-11 18:15:49 +01:00
Alex Shvartzkop f823a43c1c Update translations 2025-01-11 20:08:08 +03:00
2tama3 a31302da9f Translated using Weblate (Japanese)
Currently translated at 100.0% (9206 of 9206 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/ja/
2025-01-11 18:07:16 +01:00
dsa-t f51657632b Translated using Weblate (Chinese (Simplified Han script))
Currently translated at 99.9% (9203 of 9206 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/zh_Hans/
2025-01-11 18:07:16 +01:00
ZbeeGin 78fb820a26 Translated using Weblate (Polish)
Currently translated at 100.0% (9206 of 9206 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/pl/
2025-01-11 18:07:16 +01:00
dsa-t 47fc6dede2 Translated using Weblate (German)
Currently translated at 100.0% (9206 of 9206 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/de/
2025-01-11 18:07:16 +01:00
Marek Roszko 9c9a1b7895 Revert "Add a windows specific hack to make backups work past max length"
This reverts commit 6c6f8e3de6.
2025-01-10 22:17:30 -05:00
Alex Shvartzkop 3cc86898b1 Update translations 2025-01-11 03:58:32 +03:00
dsa-t 16b7b9af89 Translated using Weblate (Chinese (Simplified Han script))
Currently translated at 99.9% (9205 of 9206 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/zh_Hans/
2025-01-11 01:56:59 +01:00
dsa-t aedcae8092 Translated using Weblate (Tamil)
Currently translated at 100.0% (9206 of 9206 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/ta/
2025-01-11 01:56:59 +01:00
dsa-t b32fd3521f Translated using Weblate (Portuguese (Brazil))
Currently translated at 100.0% (9206 of 9206 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/pt_BR/
2025-01-11 01:56:59 +01:00
dsa-t b9b5c14867 Translated using Weblate (Polish)
Currently translated at 99.9% (9203 of 9206 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/pl/
2025-01-11 01:56:59 +01:00
dsa-t 82084218d9 Translated using Weblate (Spanish)
Currently translated at 98.3% (9053 of 9206 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/es/
2025-01-11 01:56:58 +01:00
jean-pierre charras a4a7160b45 Fix typo in french translation 2025-01-10 17:15:13 +01:00
Alex Shvartzkop a30b99b794 Update translations 2025-01-08 14:33:02 +03:00
Wellington Terumi Uemura 1f0c58a524 Translated using Weblate (Portuguese (Brazil))
Currently translated at 100.0% (9206 of 9206 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/pt_BR/
2025-01-08 12:30:35 +01:00
CloverGit 6e8de14766 Translated using Weblate (Chinese (Simplified Han script))
Currently translated at 99.9% (9205 of 9206 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/zh_Hans/
2025-01-08 12:30:35 +01:00
2tama3 cce2bf9086 Translated using Weblate (Japanese)
Currently translated at 100.0% (9206 of 9206 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/ja/
2025-01-08 12:30:35 +01:00
Pferd O 1371a58259 Translated using Weblate (German)
Currently translated at 100.0% (9206 of 9206 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/de/
2025-01-08 12:30:35 +01:00
dsa-t ab12223247 Translated using Weblate (Chinese (Simplified Han script))
Currently translated at 99.9% (9200 of 9206 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/zh_Hans/
2025-01-08 12:30:35 +01:00
dsa-t 6a2c35dc42 Translated using Weblate (Ukrainian)
Currently translated at 86.8% (7995 of 9206 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/uk/
2025-01-08 12:30:35 +01:00
தமிழ்நேரம் ad6a4e5621 Translated using Weblate (Tamil)
Currently translated at 100.0% (9206 of 9206 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/ta/
2025-01-08 12:30:35 +01:00
dsa-t 99fc22adb5 Translated using Weblate (Swedish)
Currently translated at 99.8% (9194 of 9206 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/sv/
2025-01-08 12:30:35 +01:00
dsa-t dfaae5e3ca Translated using Weblate (Serbian)
Currently translated at 9.9% (913 of 9206 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/sr/
2025-01-08 12:30:34 +01:00
dsa-t dfa8f2e0ec Translated using Weblate (Russian)
Currently translated at 100.0% (9206 of 9206 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/ru/
2025-01-08 12:30:34 +01:00
dsa-t 2704c30404 Translated using Weblate (Polish)
Currently translated at 99.9% (9203 of 9206 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/pl/
2025-01-08 12:30:34 +01:00
dsa-t 8a1072ce75 Translated using Weblate (Norwegian Bokmål)
Currently translated at 48.5% (4465 of 9206 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/nb_NO/
2025-01-08 12:30:34 +01:00
dsa-t e5cb28c7fe Translated using Weblate (Korean)
Currently translated at 99.7% (9185 of 9206 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/ko/
2025-01-08 12:30:34 +01:00
dsa-t ed7f0d3234 Translated using Weblate (Japanese)
Currently translated at 99.9% (9202 of 9206 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/ja/
2025-01-08 12:30:34 +01:00
dsa-t 7be1c84be2 Translated using Weblate (Hungarian)
Currently translated at 3.5% (326 of 9206 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/hu/
2025-01-08 12:30:34 +01:00
dsa-t c37358fd33 Translated using Weblate (Finnish)
Currently translated at 99.6% (9178 of 9206 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/fi/
2025-01-08 12:30:34 +01:00
dsa-t c71db323fb Translated using Weblate (Spanish)
Currently translated at 98.3% (9052 of 9206 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/es/
2025-01-08 12:30:34 +01:00
dsa-t b8d09c9b42 Translated using Weblate (German)
Currently translated at 100.0% (9206 of 9206 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/de/
2025-01-08 12:30:34 +01:00
dsa-t 29fe6c1446 Translated using Weblate (Danish)
Currently translated at 49.7% (4581 of 9206 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/da/
2025-01-08 12:30:34 +01:00
dsa-t 9b3ee263c3 Translated using Weblate (Czech)
Currently translated at 84.1% (7751 of 9206 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/cs/
2025-01-08 12:30:33 +01:00
dsa-t c54f57b8e5 Translated using Weblate (Bulgarian)
Currently translated at 7.7% (714 of 9206 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/bg/
2025-01-08 12:30:33 +01:00
Alex Shvartzkop 603a500bc0 EAGLE import: allow more lines before <eagle> tag.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/19528
2025-01-08 16:23:44 +05:00
Alex Shvartzkop 7e68c57747 Cancel "Fetching repository" job properly when PCM is opened.
(cherry picked from commit 883b615fef)
2025-01-08 16:10:24 +05:00
Alex Shvartzkop 644c4f8c0a Don't lose reference designators when importing EasyEDA Pro/Std, LTspice, CADSTAR schematics.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/19490
2025-01-07 19:13:58 +05:00
Jeff Young 5ae377f41a Limit length of search strings to prevent lockups.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/19464

(cherry picked from commit 48bb6b137c)
2025-01-07 11:56:55 +00:00
Jeff Young 1d534303d4 Handle wildcards AND case-insensitivity in pin_type comparisons.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/19513

(cherry picked from commit d4865899c5)
2025-01-07 11:55:38 +00:00
Wayne Stambaugh 5d2b515f7b Tag stable version 8.0.8 release candidate 1. 2025-01-05 17:48:24 -05:00
Alex Shvartzkop 2f37efbd0f Update translations 2025-01-05 22:16:16 +03:00
dsa-t f492c0152d Translated using Weblate (Russian)
Currently translated at 100.0% (9206 of 9206 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/ru/
2025-01-05 20:11:14 +01:00
dsa-t 13373d2c9b Translated using Weblate (Chinese (Traditional Han script))
Currently translated at 99.0% (9119 of 9206 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/zh_Hant/
2025-01-05 20:11:14 +01:00
dsa-t e3d5176cad Translated using Weblate (Chinese (Simplified Han script))
Currently translated at 99.9% (9197 of 9206 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/zh_Hans/
2025-01-05 20:11:14 +01:00
dsa-t ef712b2f1c Translated using Weblate (Swedish)
Currently translated at 99.7% (9184 of 9206 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/sv/
2025-01-05 20:11:14 +01:00
dsa-t f34889ab02 Translated using Weblate (Russian)
Currently translated at 100.0% (9206 of 9206 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/ru/
2025-01-05 20:11:14 +01:00
dsa-t 8707640a0b Translated using Weblate (Polish)
Currently translated at 99.8% (9190 of 9206 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/pl/
2025-01-05 20:11:14 +01:00
dsa-t 85d4ce89e8 Translated using Weblate (Dutch)
Currently translated at 99.7% (9182 of 9206 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/nl/
2025-01-05 20:11:13 +01:00
dsa-t 95a80bf9f6 Translated using Weblate (Japanese)
Currently translated at 99.9% (9200 of 9206 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/ja/
2025-01-05 20:11:13 +01:00
dsa-t 25999c6b6a Translated using Weblate (Spanish (Mexico))
Currently translated at 99.7% (9182 of 9206 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/es_MX/
2025-01-05 20:11:13 +01:00
dsa-t 4b286644f4 Translated using Weblate (Spanish)
Currently translated at 98.3% (9052 of 9206 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/es/
2025-01-05 20:11:13 +01:00
dsa-t 65ac097c32 Translated using Weblate (Greek)
Currently translated at 99.2% (9140 of 9206 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/el/
2025-01-05 20:11:13 +01:00
dsa-t e6417afb0e Translated using Weblate (German)
Currently translated at 100.0% (9206 of 9206 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/de/
2025-01-05 20:11:13 +01:00
Pferd O 69e15f2ff5 Translated using Weblate (German)
Currently translated at 100.0% (9206 of 9206 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/de/
2025-01-05 20:11:13 +01:00
Alex Shvartzkop de6238e892 Specctra SES: support unquoted path with spaces in <session_id>
(cherry picked from commit d625ce2e63)
2025-01-05 23:41:08 +05:00
Mark Roszko a69b7f8802 Use newer ngspice port to fix arm64 build
(cherry picked from commit d03a59de4c)

Co-authored-by: Marek Roszko <mark.roszko@gmail.com>
2025-01-05 15:02:15 +00:00
Alex Shvartzkop aa43ac592c Update translations 2025-01-05 12:50:08 +03:00
Wellington Terumi Uemura 445a92a275 Translated using Weblate (Portuguese (Brazil))
Currently translated at 100.0% (9204 of 9204 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/pt_BR/
2025-01-05 10:38:51 +01:00
dsa-t 4bfb59bcea Translated using Weblate (Russian)
Currently translated at 100.0% (9205 of 9205 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/ru/
2025-01-05 10:38:51 +01:00
dsa-t 31f5645811 Translated using Weblate (Russian)
Currently translated at 99.9% (9203 of 9204 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/ru/
2025-01-05 10:38:51 +01:00
Alex Shvartzkop 14ace594e7 gerbview: Sort layer maps after reordering view layers.
Otherwise we get previous freed pointers in m_orderedLayers.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/19394
Fixes KICAD-P65

(cherry picked from commit bc6b620b8f)
2025-01-05 13:32:52 +05:00
Alex Shvartzkop 8f6edd4f9e Fix opening zip archives from project manager tree on Win11.
Also removes unused OpenFile function.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/19399
2025-01-05 13:28:58 +05:00
Alex Shvartzkop 9e39b3bbec Eagle: Make pad drill optional to support some DipTrace-exported boards. 2025-01-05 13:28:02 +05:00
Alex Shvartzkop b68b3cce17 Support Specctra SES import from TopoR.
TopoR export resolution units in upper case for some reason.

(cherry picked from commit b078d828df)
2025-01-05 13:27:04 +05:00
Alex Shvartzkop 6e7934dc3e Fix compatibility with Allegro PCB Router (Specctra) sessions.
"default_smd" clearance type is not a valid value.
Could have used "wire_smd" but it doesn't seem to matter nowadays.

(cherry picked from commit 86bcf840c1)
2025-01-05 13:26:54 +05:00
Alex Shvartzkop ef435b256f Project manager: Fix wrong background near left toolbar after changing Preferences on MSW.
(cherry picked from commit af8ad6651a)
2025-01-05 13:26:29 +05:00
Alex Shvartzkop 020021e7f2 Fix assert in hotkey list when double-clicking on a section header.
Assert message:

Assertion failed at C:\jenkins\workspace\build-windows-kicad-msvc-8.0-stable\.build\kicad\common\widgets\widget_hotkey_list.cpp:309 in WIDGET_HOTKEY_LIST::getExpectedHkClientData: hkdata != nullptr - No hotkey data found for list item

Fixes KICAD-7NV

(cherry picked from commit 9b40e6b2e3)
2025-01-05 13:25:51 +05:00
Alex Shvartzkop a678c9b03a Support legacy timestamps with stripped leading zeros.
In old kicad_pcb files, the timestamp can have less than 8 symbols
if leading zeros are stripped.

For example: 0939A342 -> 939A342

(cherry picked from commit 472192f4b8)
2025-01-05 13:24:58 +05:00
Alex Shvartzkop dc88df7919 IPC-2581: Fix scale when using Inches.
(cherry picked from commit 787d174bec)
2025-01-05 13:24:43 +05:00
Alex Shvartzkop 6effb20e8c Send wxSIGKILL to STEP/OCCT 3D model export process when cancelled.
Also adds a cancel confirmation dialog.

Also fixes an issue where a thread termination error message is shown
when calling Delete(), because the thread has already exited after
Wait().

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

(cherry picked from commit add58faa30)
2025-01-05 13:23:47 +05:00
Mark Roszko 1edd151dbe Update vcpkg for ngspice 44
(cherry picked from commit ee7323dc42)

Co-authored-by: Marek Roszko <mark.roszko@gmail.com>
2025-01-04 19:59:34 +00:00
Seth Hillbrand 7c13df5aa5 Prevent events from firing in the main window during load
Closing the source window while another wx loop is running can lead to
async events being processed, leaving the current stack out of scope

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

(cherry picked from commit 6d99f62c96)
2025-01-03 09:28:43 -08:00
Ian McInerney 241f4cae2a Use existing string for ohm-meter units
(cherry picked from commit ce5f3f642e)
2025-01-03 12:28:58 +00:00
Andrea Greco 92a1f0dc1d Transmission Line: Add measure unit to Rho constant
Fixes https://gitlab.com/kicad/code/kicad/-/issues/19312

(cherry picked from commit 49b949cec7)
2025-01-03 12:28:38 +00:00
Seth Hillbrand ccf3b0af35 Adjust DRC clearance for net ties
Items that are part of net ties (pads and copper shapes that connect to
them) should allow connections from any net in the tie.  This prevents
clearance errors from being generated for matched nets

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

(cherry picked from commit 41d4a8caab)
2025-01-02 17:25:29 -08:00
Maciej Suminski e2e95854c2 Fix pin rotation parsing in the legacy symbol library plugin
Commit 352463df removes char values for PIN_ORIENTATION, so
magic_enum::enum_cast can no longer do its magic.

(cherry picked from commit 67f717b56a)
2025-01-02 17:25:29 -08:00
Seth Hillbrand d5fdcdcd98 Handle DRC rules that limit PTH/NPTH in courtyards
Allows custom rules that explicitly allow holes from one footprint to
overlap the courtyard from another

(cherry picked from commit caa18568e0)
2025-01-02 17:25:29 -08:00
Seth Hillbrand 67a1c70172 Don't count removed zone layers
This does 3 things:
1) Removes unused zone layers on load
2) Does not save unused zone layers
3) Removes unused zone layers from connectivity calculation

(1) Prevents existing boards from using unused zone layers for any
connectivity or rendering.  (2) Updates the contents of boards with
removed zone layers to prevent them from propagating.  (3) updates the
connectivity while running pcbnew and removing a zone layer

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

(cherry picked from commit 6e591f5f91)
2025-01-02 17:25:29 -08:00
Johannes Maibaum 9ff380a137 Don't leak blank_cursor on warp (X11)
Also, for completeness, unref cur_cursor which we ref'd before hiding
it.

(cherry picked from commit 15e963bb32)
2025-01-02 17:25:29 -08:00
SubaruArai 049c555e7e Update QR footprint wizard
- Allows more than 62 bytes
- Adjusts size of code based on data or parameters
- Allows selection of ECC

(cherry picked from commit 8b3fc41ee5)
2025-01-02 17:25:29 -08:00
xx dc50f50128 Add rectangle height and width to properties
Fixes https://gitlab.com/kicad/code/kicad/-/issues/17181

(cherry picked from commit 5ff61ae561)
2025-01-02 17:25:29 -08:00
JamesJCode 4bc5ceb109 Allow selection of PCB_MARKERs when not on active layer
Fixes https://gitlab.com/kicad/code/kicad/-/issues/19258

(cherry picked from commit 669be5378c)
2025-01-03 00:48:13 +00:00
Seth Hillbrand 893deff3b5 Skip hidden files in backup
We don't need to parse hidden files/directories for backup targets.
This can be very large (in the case of .git directories) and thus
slow when working over NAS.

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

(cherry picked from commit 2eea14ea58)
2025-01-02 16:26:48 -08:00
Dhineshkumar S 9d36205ced Disable custom color selection when Fill Mode is Body Background Color
Currently, the system allows custom color selection for the Fill Color
property in the Properties toolbar even when Fill Mode is set to Body
Background Color via the Properties window. However, this does not update
the color to match the Body Background color. To fix this, custom color
selection for Fill Color will be disabled when Body Background Color is
chosen.

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

(cherry picked from commit cb41f39045)
2025-01-02 18:17:41 +00:00
JamesJ b2427efd85 Auto-fill new net global / local label names from connectivity
Currently, new global or local net labels are auto-filled with the
net name if the wire is driven by a global or local label. This
currently happens recursively within SCH_LINE. This fix moves this
to determining the driver from the connectivity graph, and removes
the determination from the SCH_LINE code where it does not belong.

(cherry picked from commit b01796cb84)
2025-01-02 18:10:01 +00:00
Jon Evans 800187c956 DbLib: Use case-insensitive lookup for column caching
(cherry picked from commit bdb2c3a025)

Co-authored-by: Jon Evans <jon@craftyjon.com>
2025-01-02 17:59:36 +00:00
jean-pierre charras c4bc337201 French translation update 2025-01-01 16:20:59 +01:00
Seth Hillbrand a20d76c7f1 Fix help header file and translations
The header was updated after the markdown file, so reverting to the
previous markdown version removed the older header data as well
2024-12-30 15:10:38 -08:00
Seth Hillbrand 19c91a1308 Revert translation files with older help 2024-12-30 13:47:52 -08:00
Seth Hillbrand 8c68239fb1 Revert string change 2024-12-30 13:40:35 -08:00
Seth Hillbrand 496b19d6fb Update translations 2024-12-30 13:32:04 -08:00
Huanyin Liu 751f83e02f Translated using Weblate (Chinese (Simplified Han script))
Currently translated at 99.9% (9201 of 9204 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/zh_Hans/
2024-12-30 22:16:50 +01:00
CloverGit 427175c465 Translated using Weblate (Chinese (Simplified Han script))
Currently translated at 99.9% (9195 of 9204 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/zh_Hans/
2024-12-30 22:16:50 +01:00
Pferd O c56ef6224e Translated using Weblate (German)
Currently translated at 99.9% (9203 of 9204 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/de/
2024-12-30 22:16:50 +01:00
Wellington Terumi Uemura eb0ea9abb8 Translated using Weblate (Portuguese (Brazil))
Currently translated at 100.0% (9204 of 9204 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/pt_BR/
2024-12-30 22:16:50 +01:00
Marek Roszko 6c6f8e3de6 Add a windows specific hack to make backups work past max length
Since backups are most likely to encounter max path limitations compared to other things we do in kicad
2024-12-30 10:21:37 -05:00
Marek Roszko 6d2ac23375 Add a function to create long paths on windows 2024-12-30 10:20:27 -05:00
Wayne Stambaugh 1593a7082e Fix GCC build warnings. 2024-12-30 09:49:12 -05:00
Marek Roszko 483349bd11 Hackfix build link error due to template being instantiated twice 2024-12-29 06:13:39 -05:00
Jeff Young 7288d71405 Remove a couple of fixed-version-number stragglers.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/18809
2024-12-25 18:22:13 +00:00
Jeff Young 0dbac41569 Fixup fill versions.
Older versions saved some non-symbol shapes with wrong fill mode.

The property inspector also sets the wrong fill mode.

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

(cherry picked from commit f1cbcc83fe)
2024-12-25 17:44:40 +00:00
Mark Roszko d501e1e5f2 Fix another iterator exception
(cherry picked from commit a7147bd22e)
2024-12-25 07:49:39 -05:00
Mark Roszko 99a177e307 Fix exception due to decrementing end() on a list of size 0
(cherry picked from commit 01fb6c80ed)
2024-12-25 07:49:07 -05:00
JamesJCode c1fdd09eee Handle simulator plot cell attributes correctly
Fixes https://gitlab.com/kicad/code/kicad/-/issues/17841

(cherry picked from commit 2cfa33a50a)
2024-12-24 21:51:33 +00:00
Jeff Young 8417ca7836 Use render cache (when available) for 3D viewer.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/18672
2024-12-24 21:00:45 +00:00
Jeff Young b02e0f61f9 Plot from render cache if fonts aren't embedded.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/18672

(cherry picked from commit 3d9784ded3)
2024-12-24 20:37:22 +00:00
Jeff Young 098b1ae7c7 Update pin table when model changes.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/19253

(cherry picked from commit 9c57d6c84f)
2024-12-24 20:33:08 +00:00
Jeff Young fbddae9c08 Fix parsing of Altium overbar notation.
Use the AltiumPinNamesToKiCad() algorithm for all conversions,
but don't do any conversions on plain text (RECORD=4).

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

(cherry picked from commit 756f0c5027)
2024-12-24 20:29:50 +00:00
John Beard f172de5070 Prefs: fix bug in FP editor prefs resetting
Fixes: https://gitlab.com/kicad/code/kicad/-/issues/19369
(cherry-picked from 4b5f809961)
2024-12-24 23:05:08 +08:00
Wayne Stambaugh 846a346d21 Fix crash when undoing new sheet action from within sheet.
Make sure the hierarchy navigation history iterator is valid before
attempting to remove an entry from the history list.

Fix an undetected crash where two undo entries were created when drawing
a new sheet.  The first entry was sheet properties entry and the second
was for the drawing the new sheet.  The second undo would cause a crash
because the sheet no longer existed for the sheet properties commit.

Remove consecutive duplicate hierarchy navigator history history entries.
Navigating to the same path multiple times doesn't really make a lot of
sense.

Don't rebuild the hierarchy twice when drawing new sheets.  This is handled
when pushing a commit.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/19358
2024-12-24 08:49:32 -05:00
Seth Hillbrand 4d60893204 Turn off incremental connectivity for small schematics
The benefit of incremental connectivity is only for larger
schematics.  For smaller schematics, the downside of larger bug surface
outweighs the current benefits

(cherry picked from commit 74998790e8)
2024-12-23 10:16:59 -08:00
Seth Hillbrand a611c72c27 Fix up Annular ring check
- Remove bespoke collide routine.  We should never rewrite these instead
  of using the geometry library
- Optimize check by creating unified geometry before colliding
- Make extra variable that we don't need but makes cherry-picks easier
  (min/maxAnnularWidth)

Fixes https://gitlab.com/kicad/code/kicad/-/issues/19325
2024-12-22 14:50:50 -08:00
Wayne Stambaugh d38bda4d53 Make settings migration dialog re-sizable.
Also try to improve the initial layout size after changes have been made
to controls outside the base dialog Curt.

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

Manual cherry pick from ca1f51e706
2024-12-21 12:11:01 -05:00
Wayne Stambaugh 8a09e5f3c3 Add simple timer profiling to DRC engine.
Remove the PROFILE definitions from the incremental connectivity
profiling so a special build isn't required.  If the starting and
stopping the profile timer is excessive, we can add this back.
2024-12-20 15:34:20 -05:00
Martin Berglund 337f3da7c9 Eeschema: Reduced LoadSymbol calls in PlaceSymbol
Check early if a symbol is not unique - before calling SchGetLibSymbol
and in SchGetLibSymbol checks the cache before calling LoadSymbol.

This speeds up opening the symbol browser significantly when having lots
of symbols in the design that needs to be polled from a database

Fixes https://gitlab.com/kicad/code/kicad/-/issues/18826
2024-12-20 16:54:22 +00:00
Wayne Stambaugh cf71e5707e Fix a wxRecursionGuard crash when library symbol is missing.
The various wxCHECKs in the SCH_PIN object where being raised inside
the SCH_SYMBOL object which would also raise it's own wxCHECK that
would cause a recursion guard failure and segfault.  The offending
wxCHECKs were replaced with null pointer checks.  Missing library
symbol links will be shown with the missing library symbol.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/17146
2024-12-20 11:11:39 -05:00
Jeff Young bbd2d75a62 Fix double-click in footprint chooser.
Also fixes the assert when closing the chooser after the 3D
view was shown.

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

(cherry picked from commit a3f69046ba)
2024-12-20 13:33:28 +00:00
Seth Hillbrand 162c7f7d8c Update translations 2024-12-19 16:48:36 -08:00
gfbdrgng 4ef09d3da4 Translated using Weblate (Russian)
Currently translated at 99.9% (9203 of 9204 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/ru/
2024-12-20 01:41:47 +01:00
co8 j 962bad981c Translated using Weblate (Japanese)
Currently translated at 100.0% (9204 of 9204 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/ja/
2024-12-20 01:41:47 +01:00
CloverGit 8d44b9cf05 Translated using Weblate (Chinese (Simplified Han script))
Currently translated at 99.8% (9194 of 9204 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/zh_Hans/
2024-12-20 01:41:47 +01:00
Wellington Terumi Uemura 60c3ac7919 Translated using Weblate (Portuguese (Brazil))
Currently translated at 100.0% (9204 of 9204 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/pt_BR/
2024-12-20 01:41:47 +01:00
JamesJCode fec4674470 Ensure deterministic ordering in orcadpcb2 netlist exporter
Fixes https://gitlab.com/kicad/code/kicad/-/issues/18822

(cherry picked from commit 4425387359d1f480661839937c2357186be9873c)
2024-12-19 23:03:12 +00:00
jean-pierre charras d47e884eb3 Fix a lot of compil warnings (on msys2/gcc 14.2)
Fix also a compil warning about a strange line ( Typo? )
2024-12-19 17:39:17 +01:00
Jeff Young f920882a17 Fix errors from earlier cherry-pick. 2024-12-19 14:41:17 +00:00
Jeff Young 98a5c1935e Cleanup for nullptr hygiene.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/19318

(cherry picked from commit c12ec3e2ac)
2024-12-19 13:08:59 +00:00
Jeff Young c0feb6347f Reduce dependency on dynamic_cast.
(cherry picked from commit 04b5ccbdb2)
2024-12-19 13:08:40 +00:00
Wayne Stambaugh 77f6cd5a88 Fix thread deadlock when closing the footprint chooser dialog.
Fixing this required disabling the footprint/3D viewer canvas drawing
before destroying the canvas in the dialog dtor.  This in turn required
adding a virtual method to DIALOG_SHIM that can be overridden by the
derived object to allow performing actions during dialog shutdown that
can be problematic when performed in the dialog dtor.  Please note that
this only works for quasi-modal dialogs.  Modal and modeless dialogs
should use close window events.

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

(cherry picked from commit 2e7d819b5d)
2024-12-18 08:28:37 -05:00
Wayne Stambaugh ed5068829f Use wxCHECK instead of wxASSERT in connection graph code.
Using wxASSERT would allow segfaults when rebuilding the connection graph
under certain conditions.  Using appropriate wxCHECK fixes the segfault
issues.  This will most likely result in broken connection graphs.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/18136
2024-12-15 09:12:28 -05:00
Wayne Stambaugh ffa3e98c1f Don't fetch bus alias multiple times when rebuilding connection graph.
Bus aliases are per schematic not per sheet path.  They only need to be
added to the connection graph once per schematic.  Loading bus aliases
multiple times when there are multiple instances of a schematic just
replaces the existing bus alias map entry.

This brings the connection graph more in line with the development branch
changes made in commit edc7603d2a.
2024-12-14 15:09:23 -05:00
Wayne Stambaugh 23619629bd Fix shadowed variable in connection graph.
This was fixed in commit e2c53df13b and
somehow got clobbered by commit 7d7decafd4.
2024-12-14 12:28:30 -05:00
Jan Wichmann 726b242214 kicad: Sort project templates alphabetically by name
(cherry picked from commit 68a00c131d)
2024-12-11 14:52:27 +01:00
Jan Wichmann 1c76f4c559 kicad: Fixed multi-line title in project template selector
Replaces some file extensions with symbols

(cherry picked from commit 6d44d407a7)
2024-12-11 14:52:08 +01:00
Seth Hillbrand 94124538da Update translations 2024-12-10 16:05:55 -08:00
Pferd O 1c88c70985 Translated using Weblate (German)
Currently translated at 100.0% (9198 of 9198 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/de/
2024-12-11 01:05:01 +01:00
Pferd O eba5f70b59 Translated using Weblate (German)
Currently translated at 99.9% (9197 of 9198 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/de/
2024-12-11 01:05:01 +01:00
EdizonTN 8873845e67 Translated using Weblate (Czech)
Currently translated at 84.0% (7735 of 9198 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/cs/
2024-12-11 01:05:01 +01:00
Seth Hillbrand f00ffe24b0 Check secondary driver names when merging
If two nets are joined by a global power pin but both have global labels
that override the net name, we still want them to be merged.  This
checks for all net names in the drivers when looking for subgraph
merging candidates

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

(cherry picked from commit ad985aff9d)
2024-12-10 16:02:50 -08:00
John Beard 4578316e6f Pcbnew: fix track start property display
The display in the properties manager for arc tracks
was wrong. Implement a set of Get/SetStartX/Y functions
for the traces, to match the End functions.

This is needed because PCB_ARC overrides GetPosition
to return the arc center, not the start position (whereas
PCB_TRACK does return the start for GetPosition)

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/19215
(cherry picked from commit 37469b00b2)
2024-12-10 16:29:38 +08:00
John Beard ad23a19391 Pcbnew: rebuild layer preset list on language change
And initialise from the translations in the first place.

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/19181
(cherry picked from commit f9238f58f4)
2024-12-10 16:29:38 +08:00
JamesJCode 76d8662891 Allow DRC markers to be selected with area selection
Fixes https://gitlab.com/kicad/code/kicad/-/issues/19258

(cherry picked from commit 29798a6400)
2024-12-09 23:16:09 +00:00
JamesJCode 765e7ac02f Allow selection of PCB_MARKERs when not on active layer
Fixes https://gitlab.com/kicad/code/kicad/-/issues/19258

(cherry picked from commit 669be5378c)
2024-12-09 23:16:09 +00:00
Markus Becker edf16e6fc6 Fix typo "readabla" in schema
(cherry picked from commit 58feb014fe)
2024-12-09 21:43:11 +00:00
Wayne Stambaugh f06380f05f Preserve symbol unit when loading schematic with missing instance data.
This only applies to when there is a single instance of a given schematic.

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

(cherry picked from commit 0e7c7ba9dd)
2024-12-09 15:56:49 -05:00
Jon Evans f899755035 Remove library description and keywords from footprint comparator
These properties are not displayed or editable in
the board editor, it makes no sense to report them
as having changed in the library.

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


(cherry picked from commit 78f01b829d)

Co-authored-by: Jon Evans <jon@craftyjon.com>
2024-12-08 16:19:14 +00:00
Jon Evans 724feccdb8 Ratsnest: account for coincident anchors on different layers
When a net happens to have only coincident items on different
layers, the triangulator was not considering the item layers
when optimizing them away.  Add a special case to ensure that
the ratsnest edges will exist in this situation.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/18982
2024-12-08 11:05:39 -05:00
Jon Evans 96378dd5bc Do not save fields_autoplaced for text with no fields
Fixes https://gitlab.com/kicad/code/kicad/-/issues/19159
2024-12-08 10:09:24 -05:00
jean-pierre charras 3a1b14a456 Eeschema, *.kicad_pro file: Use for the root sheet the canonical name "Root"
Previously, the translated name was stored in file.

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

(cherry picked from commit d51c7372b4)
2024-12-07 16:07:02 +01:00
Jeff Young 86bc517006 Fix typo. 2024-12-07 14:33:40 +00:00
Jeff Young 1ce594d689 Add example for silk:board_edge clearance.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/19260
2024-12-07 13:35:38 +00:00
Jeff Young 1e8088a8cd Ignore invisible pads in enumeration tool.
Also, draw pad-renumbering-lines based on mouse pos, not
snapped mouse pos.

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

(cherry picked from commit 672edfdffd)
2024-12-06 22:23:46 +00:00
Jeff Young ad41288ec0 Handle group duplicate in footprint editor.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/19245

(cherry picked from commit 97439d2cf6)
2024-12-06 18:40:49 +00:00
John Beard 66b392cdca Eeschema: avoid crash on save if a polyline is empty
This normally should never happen, but could do in limited cases such
as from bad imports or CI/testing inputs. It's probably still a bug
in any real design usage, but assert and continue instead of crash.
2024-12-06 21:46:22 +08:00
Andrej Valek c2918098c2 ReparentModal: fix case when parent is not available
In some situations then parent window couldn't be available. Eg, when
eeschema is executed as standalone on macOS and trying to show
the global design block table dialog before the main frame exists.
So replace the assert with return and check the windows pointers bellow.

(cherry picked from commit 20ee4effdc)
2024-12-06 08:17:55 -05:00
Andrej Valek f92b601a45 ShowModal: override method in DIALOG_SHIM
All DIALOG_SHIM dialogues which should be modal, has a problem on OSX
that parent could be lost. So call ReparentModal to fix this before
calling the base ShowModal method. This should fix the problem when
modal window has been hidden when windows were switched.

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

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/17460
(cherry picked from commit 3ad92bc8db)
2024-12-06 08:17:51 -05:00
Jeff Young 3c206df680 Reduce dependency on dynamic_cast.
(Especially where it is no-worky on MacOS.)

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

(cherry picked from commit 94f995c49e)
2024-12-06 08:04:50 -05:00
Jon Evans 439b2c928a Revert "Do not use dynamic_cast on cross-module objects"
This reverts commit 21dd46d379.
2024-12-06 07:34:57 -05:00
jean-pierre charras 7df7aaab3c QA: fix an issue in schematic_file_util.cpp, breaking a QA test.
A "old" data was not deleted at the right time, and because it was managed
by a std::unique_ptr, a Dtor was called at the wrong time, destroying a
static variable.
2024-12-06 13:24:19 +01:00
jean-pierre charras 18b0144354 Fix qa_gerbview build (link issue) on msys2. 2024-12-05 18:14:13 +01:00
Jon Evans 21dd46d379 Do not use dynamic_cast on cross-module objects
C++ RTTI cannot be used reliably to cast between types
across a linker boundary (for example, between EDA_ITEM and
BOARD_ITEM).  Doing so will cause failures that only happen
on some platforms, some of the time.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/18685
2024-12-04 19:36:28 -05:00
Jeff Young a272de67d2 Don't change selection after selecting find-next hit.
(It will just wipe out the hit.)

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

(cherry picked from commit 6150586f01)
2024-12-04 18:25:28 +00:00
jean-pierre charras 2e023fcc99 Schematic editor: fix some issues that can crash the editor on closing.
- Add a test to be sure a SCHEMATIC exists before trying to use it
- Delete items in Repeat list and undo/redo list before deleting the schematic
- Delete also these items when loading a new schematic (the repeat list was
not cleaned previously)
Before these fixes I see a use after delete issue due to dangling pointers
stored in Repeat list.

(cherry picked from commit d778cb6647)
2024-12-04 18:24:29 +00:00
Jon Evans 80d01a5ddc Allow plot options to override the board tenting settings
Fixes https://gitlab.com/kicad/code/kicad/-/issues/18991
2024-12-04 00:14:53 -05:00
Alex Shvartzkop bcedb4540b Remove compensation padding in KiCad launcher for newer wx versions.
Previously an additional padding was used to compensate for a
wxGridBagSizer bug in wxWidgets:
https://github.com/wxWidgets/wxWidgets/issues/24550

This bug was fixed in wx 3.2.6, so we can conditionally remove this
padding.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/19239
2024-12-03 21:35:32 +03:00
Jeff Young 0ec3720ee5 Don't hang when trying to paste image as text.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/19079

(cherry picked from commit 5caaf22949)
2024-12-03 16:22:50 +00:00
Jeff Young fb486ff6b4 Handle degenerate polygons in RTrees.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/18600

(cherry picked from commit d5ecb4ab55)
2024-12-03 16:22:50 +00:00
Lucas Gerads 71dba8a064 Eeschema: Only populate spice code in the simulation dialog code field
Fixes https://gitlab.com/kicad/code/kicad/-/issues/18771

(cherry picked from commit ef8f8b837a)
2024-12-03 16:22:50 +00:00
Jeff Young 82faab25fa Plot labels in colour.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/19040

(cherry picked from commit 410868253a)
2024-12-03 16:22:50 +00:00
Jeff Young eb5229b8f3 Make sure descendants get new UUIDs when pasting.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/19052

(cherry picked from commit 8246637d69)
2024-12-03 16:22:50 +00:00
Jeff Young fa8a9843b1 Keep BOARD_DESIGN_SETTINGS DRC marker exclusions up-to-date.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/17429

(manually cherry picked from commit 0598ca0f90)
2024-12-03 16:22:50 +00:00
John Beard a7d81c6aaa Fabmaster: unify text settings, adjust rotations.
This is a little tricky, but this seems to be the simplest
way to approximate the right text placement.

There are still some minor offsets and text size adjustments,
which might be possible to compensate for by experimentation.

(cherry picked from commit fee1d115a6)
2024-12-03 23:32:19 +08:00
John Beard 6eaa40c644 Fabmaster: some circles on silkscreen seem to be filled
(cherry picked from commit 7d2b500a8c)
2024-12-03 23:32:19 +08:00
John Beard 9e1ff91cf1 Fabmaster: perform y-flip for back-layer arcs/circles in footprints
I'm not exactly sure where the flip comes in, but it seems to be
universal at least across various files:

* RK3588
* BeagleBone Black
* Some local boards as well

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/19224
(cherry picked from commit 54b223a5be)
2024-12-03 23:32:11 +08:00
John Beard a2d94dbacc Fabmaster: put DISPLAY_TOP/BOTTOM on silkscreen layers
These layers seem to usually be used for silkscreen
elements as well as SILKSCREEN_TOP/BOTTOM

(cherry picked from commit 3521e78a0e)
2024-12-03 22:25:37 +08:00
John Beard ea7cde81eb Fabmaster: don't show default refdeses
All the footprints have a ref-des field by default in KiCad, but if the
silkscreen text isn't present in the imported file, we should hide it.
If we see a silkscreen refdes, _then_ show it.

(cherry picked from commit 1d0ba992da)
2024-12-03 22:25:37 +08:00
John Beard 6bbbc07998 Fabmaster: handle squares, oblongs, and regular polygons.
Fabmaster supports at least triangles, hexagons x and y, octagons
and diamonds.

(cherry picked from commit e2136db5c2)
2024-12-03 22:25:37 +08:00
John Beard b01ed7171c Fabmaster: omit DEVICE TYPE, COMPONENT VALUE, TOLERANCE texts
These seem like footprint fields, but there is no obvious way
to associate them. Dumping them on the the silk/fab layers creates
huge overlapping spam on the board, so for now, just leave them
out.

Allegro has a more "2D" layer system with classes (e.g. DEVICE TYPE)
and subclasses (SILKSCREEN_TOP), which make things difficult to
make map cleanly to KiCad layers.

(cherry picked from commit 29a66714cd)
2024-12-03 22:25:37 +08:00
John Beard 0d3208e656 Fabmaster: fix some text import and unify item creation
Some texts were left out of the GRAPHIC_ITEM -> BOARD_ITEM
dispatch in some paths. Unify this item creation to avoid
this possibility (and reduce duplication).

(cherry picked from commit 8152ec06d1)
2024-12-03 22:25:37 +08:00
John Beard 12098f4a3c Fabmaster: better detection of closed vs open polygons
This seems to be a lossy export conversion - it's not possible
to tell apart a closed zone and a line that happens to end where
it started.

Look for features that indicate that a sequence of graphics are
"open" and should be rendered as a set of discrete graphics,
or "closed" and should be a single polygon.

At least for objects in the BeagleBone Black export, this seems
to work well.

(cherry picked from commit 9a68a9c310)
2024-12-03 22:25:37 +08:00
John Beard 9ce74a8807 Fabmaster: handle FIG_RECTANGLE
(cherry picked from commit c22798ec72)
2024-12-03 22:25:37 +08:00
John Beard e94ea208ab Fabmaster: use User layers for unknown layers
This is a bit of a hack as it will still only allow
9 more layers and drop the rest, but it's a start and
allows testing using the Beaglebone Black board and the
board in issue 19174.

(cherry picked from commit faae009dba)
2024-12-03 22:25:37 +08:00
John Beard c1630ee0f1 Fabmaster: handle circles
Some circles are represented as ARC with start == end, but there
are also CIRCLE elements.

For consistency with the existing code, actually use 360-degree
arcs for circles (which also allows them to be used in polygon
holes if needed)

(cherry picked from commit 6cfcba9b37)
2024-12-03 21:49:32 +08:00
John Beard 4ceccf4c47 Fabmaster: skip components with no x, y, or rotation
These appear to be 'unplaced' components, which we don't really
have a good way to represent at the moment. For the time being,
skip them.

Relates-To: https://gitlab.com/kicad/code/kicad/-/issues/19174
(cherry picked from commit bac027881a)
2024-12-03 21:48:47 +08:00
John Beard 7888eb768e Fabmaster: never add null holes to polygons
By adding points to holes as we go, we leave ourselves open
to adding invalid (<3 point) holes to the polygons. This causes
crashes if it happens, so we should never allow it to happen.

Instead of building holes in-place, construct them externally
and only add them if they are valid.

This probably wouldn't actually happen for a valid Fabmaster
file, but if it did, it would be bad new, and we shouldn't leave
crashable pathways facing user input.

(cherry picked from commit 926ef7677b)
2024-12-03 21:48:45 +08:00
John Beard 6a359eb433 Fabmaster: handle circular zone cutouts
(cherry picked from commit 8a56d3e2b9)
2024-12-03 21:45:16 +08:00
Seth Hillbrand 5552d63f70 Fix crash in symbol editor GetlibraryNames
GetLibrary is allowed to return null, so we need to check before
dereferencing

Fixes https://gitlab.com/kicad/code/kicad/-/issues/19236
2024-12-02 17:16:58 -08:00
Wayne Stambaugh ff084370d6 Begin version 8.0.8 development. 2024-12-02 16:07:46 -05:00
Wayne Stambaugh ad43570ec0 Tag stable version 8.0.7. 2024-12-02 16:04:30 -05:00
Seth Hillbrand 5dd4718db0 Update translations 2024-12-01 17:25:35 -08:00
dsa-t ea70d8cf4c Translated using Weblate (Russian)
Currently translated at 100.0% (9198 of 9198 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/ru/
2024-12-02 02:25:06 +01:00
ZbeeGin cd2879880a Translated using Weblate (Polish)
Currently translated at 100.0% (9198 of 9198 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/pl/
2024-12-02 02:25:06 +01:00
Pferd O b51c8c1b3d Translated using Weblate (German)
Currently translated at 100.0% (9198 of 9198 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/de/
2024-12-02 02:25:06 +01:00
Wellington Terumi Uemura 5db1ee930f Translated using Weblate (Portuguese (Brazil))
Currently translated at 100.0% (9198 of 9198 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/pt_BR/
2024-12-02 02:25:06 +01:00
2tama3 695dd57477 Translated using Weblate (Japanese)
Currently translated at 100.0% (9198 of 9198 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/ja/
2024-12-02 02:25:06 +01:00
Ettore Atalan 224c989072 Translated using Weblate (German)
Currently translated at 99.9% (9192 of 9198 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/de/
2024-12-02 02:25:05 +01:00
John Beard 80db7ff8cf Pcbnew: update DRC exclusions from DRC dialog
When excluding/re-including DRC violations, update the
BDS list immediately rather than waiting for the
BOARD::RecordDRCExclusions() to be called.

This was implemented in 8.99 in 0598ca0f90
(along with DRC exclusion comments).

Follow that commit's updates of the m_DrcExclusions
structures in an analogous way.

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/19113
2024-11-29 03:04:43 +08:00
jean-pierre charras 6e6d3e9b03 Revert "Try to fix a link issue in Gerbview" and try another fix 2024-11-25 16:55:28 +01:00
jean-pierre charras c08dd172d6 Try to fix a link issue in Gerbview 2024-11-25 16:38:55 +01:00
Wayne Stambaugh 7972805d07 Tag stable version 8.0.7 release candidate 1. 2024-11-24 19:06:04 -05:00
Alex Shvartzkop a86147b4b1 Optimize ConvertImageToLibShapes for EasyEDA/LCEDA schematic import.
Don't sort all symbol draw items after adding each draw item.

-75% CPU usage on typical schematic imports.

(cherry picked from commit 5323c8587a)
2024-11-24 20:54:24 +03:00
Dhineshkumar S 335bb8792f Fix switching bold option on and off alters text thickness
Currently, unselecting the bold option resets the thickness to the
standard size instead of reverting to the original thickness.
To address this, the original thickness should be preserved so it
can be restored when bold is turned off.

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

(cherry picked from commit 43b1bc52db)
2024-11-24 07:46:40 -05:00
jean-pierre charras c8f7887cf8 Simulator: fix crash when deselecting the Probe Tool in some cases.
If a schematic item was selected, when activating the probe tool from the
simulator, and deactivating from the Select Item sch editor tool, a crash
happened.
From master branch

Fixes https://gitlab.com/kicad/code/kicad/-/issues/18547
2024-11-24 10:34:22 +01:00
John Beard 2fe5c28787 Fabmaster: catch illegal parses up front
Parsing an empty string as double/int produces uninitialised data.
That is likely to cause an undefined amout of chaos later on,
so catch it explicitly with a wxCHECK.

It's still something that shouldn't happen, and could still cause
chaos, but it's at least deterministic. It also avoids putting
gigantic numbers into things that don't expect them. For example
normalising an angle of 1e303 is functionally an infinite loop.

This happens at least in files with missing fields in rows,
like in #19174's file, line 4:

S!U2306!IC!!!!!!SOT_23_5!!!!!SGM2576/TT9107!!!

The file is still broken, but now it loads.

Relates-To: https://gitlab.com/kicad/code/kicad/-/issues/19174
(cherry picked from commit 4d2d70ce22)
2024-11-24 14:04:57 +08:00
John Beard 64365de9de Update font when needed on italic/bold change
When the italic or bold nature is changed, text using outline fonts may
need to change its font. Add this to the SetItalic/SetBold functions.

Also add a counterpart SetItalicFlag function (following SetBoldFlag)
when you only need to set the flag (e.g. when importing or changing
everything in the text properties dialog).

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/18592
(cherry picked from commit b043f334de)
2024-11-24 09:51:54 +08:00
Alex Shvartzkop a950d55cb2 Show empty field for unconstrained length in length tuning properties.
Because it's confusing when the dialog shows last target value, but it
doesn't apply when you start tuning.

Also the last values are remembered in DRAWING_TOOL::PlaceTuningPattern
now, instead of global variables.

Related: https://gitlab.com/kicad/code/kicad/-/issues/18979
2024-11-23 18:11:25 +03:00
Alex Shvartzkop 3748a10ed5 Length tuning workflow improvements:
-Allow changing length tuning settings before tuning has been started
-Do not exit out of the length tuning tool after each placement
-Keep specified settings between pattern placements

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

(cherry picked from commit 78b2e53777)
2024-11-23 17:27:27 +03:00
Alex Shvartzkop 227bb76909 Don't modify m_selection while iterating over it in PCB editor.
This caused a fatal assert when selecting connected tracks with tuning patterns.

(cherry picked from commit fee8560079)
2024-11-23 17:27:16 +03:00
jean-pierre charras a20a6bb2a3 French translation update 2024-11-23 10:16:03 +01:00
jean-pierre charras 7c17aa5974 EEschema: fix crash when repeat an item (ins key), due to a null parent
A recent change set the parent member of a item put in the repeat list to
nullptr (this is OK) but the code to copy an item from this list did not
update this parent member.
From master branch, commit 8f348820
2024-11-23 10:07:38 +01:00
Dhineshkumar S 59795c81c5 Fix copy-paste issue for grids with checkboxes
Handle boolean value parsing during paste operation. The boolean value
was not being handled correctly in grid_tricks, which prevented the
boolean value from being pasted into the target row

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

(cherry picked from commit 07f96b83b7)
2024-11-21 11:37:47 -08:00
Mike Williams 84d00a7887 cli: accept multiple gerber layers for single layer plotting
Fixes: https://gitlab.com/kicad/code/kicad/-/issues/19089
(cherry picked from commit 325d6ff064)
2024-11-21 12:55:13 -05:00
John Beard 3774e31db8 Pcbnew: convert to lines should take the width of polygons if it can
Fixes: https://gitlab.com/kicad/code/kicad/-/issues/18713
(cherry picked from commit 81c1cd9af1)
2024-11-21 12:32:56 -05:00
Seth Hillbrand 69ac570658 Update translations 2024-11-21 09:29:00 -08:00
Pablo Bianchi 46ecb22ef5 Translated using Weblate (Spanish)
Currently translated at 98.5% (9055 of 9191 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/es/
2024-11-21 18:27:21 +01:00
Jan Straka ff7ea6eae0 Translated using Weblate (Czech)
Currently translated at 84.1% (7735 of 9191 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/cs/
2024-11-21 18:27:21 +01:00
Marco Ciampa 2f70ac171f Translated using Weblate (Italian)
Currently translated at 99.9% (9190 of 9191 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/it/
2024-11-21 18:27:20 +01:00
Marco Ciampa 360011e563 Translated using Weblate (Italian)
Currently translated at 99.9% (9190 of 9191 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/it/
2024-11-21 18:27:20 +01:00
CloverGit 2a0785d188 Translated using Weblate (Chinese (Simplified Han script))
Currently translated at 100.0% (9191 of 9191 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/zh_Hans/
2024-11-21 18:27:20 +01:00
Toni Laiho a480b1a5ba Translated using Weblate (Finnish)
Currently translated at 99.7% (9172 of 9191 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/fi/
2024-11-21 18:27:20 +01:00
Marco Ciampa 6f31e306a1 Translated using Weblate (Italian)
Currently translated at 99.9% (9190 of 9191 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/it/
2024-11-21 18:27:20 +01:00
Pferd O 5983815415 Translated using Weblate (German)
Currently translated at 100.0% (9191 of 9191 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/de/
2024-11-21 18:27:20 +01:00
Marco Ciampa 288050b6ec Translated using Weblate (Italian)
Currently translated at 99.9% (9190 of 9191 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/it/
2024-11-21 18:27:20 +01:00
co8 j 6d36363403 Translated using Weblate (Japanese)
Currently translated at 100.0% (9191 of 9191 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/ja/
2024-11-21 18:27:20 +01:00
Marco Ciampa 720c7d9fc4 Translated using Weblate (Italian)
Currently translated at 99.5% (9152 of 9191 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/it/
2024-11-21 18:27:20 +01:00
Wellington Terumi Uemura e009afd4a1 Translated using Weblate (Portuguese (Brazil))
Currently translated at 100.0% (9191 of 9191 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/pt_BR/
2024-11-21 18:27:20 +01:00
ZbeeGin 9e13ff25d0 Translated using Weblate (Polish)
Currently translated at 99.9% (9190 of 9191 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/pl/
2024-11-21 18:27:20 +01:00
Pferd O af1899ddc3 Translated using Weblate (German)
Currently translated at 99.9% (9190 of 9191 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/de/
2024-11-21 18:27:20 +01:00
Ian McInerney beb30dd881 Use appropriate tunning pattern icon in menus for tunning pattern generators
(cherry picked from commit 2190c37cd6)
2024-11-21 12:22:38 -05:00
Alex Shvartzkop 6d09293b11 DXF import: scale text size too inside scaled blocks.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/18525

(cherry picked from commit 37fb792411)
2024-11-21 12:19:31 -05:00
Alex Shvartzkop ca7378924c Make color picker dialog usable on hidpi monitors.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/17860

(cherry picked from commit 894bf45480)
2024-11-21 11:55:54 -05:00
Ian McInerney 74316a62d3 Always use black text in PCB calculator E-series table
The white text in dark mode is too washed out on the cell colors to be
visible. Since we already purposely subdue the colors in dark mode, the
easiest fix is to just always use black text.

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

(cherry picked from commit c7d280dfa1)
2024-11-21 11:34:06 -05:00
Dhineshkumar S 3150f467bb Fix Courtyard layers disappeared
Currently, the used layers passed from parseLayers() do not include
mandatory layers if they are missing in the loaded board file.
To fix this, we can manually add the mandatory layers to ensure they
are always enabled.

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

(cherry picked from commit 6e2ed5666d)
2024-11-21 11:28:37 -05:00
Dhineshkumar S c033c364d4 Fixing Paste Issue in Library Table
Previously, when attempting to paste an entire row copied from the global
table into a project table, the value would be pasted from the cell where
the cursor was focused, rather than from the first cell. This issue
occurred because the first cell, a checkbox column, was not selectable.
To resolve this, the checkbox column should be enabled for selection
when the Left Mouse Button event is triggered

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

(cherry picked from commit 1fc8e65f7a)
2024-11-21 11:15:17 -05:00
Mike Williams 37c14a65ed net navigator: add sheet changes to navigation history
Fixes: https://gitlab.com/kicad/code/kicad/-/issues/18616
(cherry picked from commit 284c52845d)
2024-11-21 11:07:22 -05:00
Mathieu Pilato dbf64ac0cf Fix missing current scale in AC simulation
Fixes https://gitlab.com/kicad/code/kicad/-/issues/18313

(cherry picked from commit 10d23ada48)
2024-11-21 09:40:12 -05:00
jean-pierre charras 0eda576189 Gerbview: fix a link issue on msys2: round 2
Reverts commit 6ee9fb4027
Make fix only for mingw/msys2
2024-11-20 18:29:32 +01:00
jean-pierre charras 6ee9fb4027 Gerbview: fix a link issue on msys2
mingw/msys2 is picky about order of files to link.
2024-11-20 18:06:21 +01:00
Kamil Galik 64134cee92 ADDED: 3D Mouse support in places
Gerber Viewer, Drawing Sheet Editor and Footprint Properties 3D Model tab

Fixed https://gitlab.com/kicad/code/kicad/-/issues/14002
Fixes https://gitlab.com/kicad/code/kicad/-/issues/13306
2024-11-20 15:56:19 +00:00
Jeff Young fead0eb33b Manual cherry-pick of ee8d86390e. 2024-11-18 22:44:41 +00:00
jean-pierre charras ff71b324a1 EEschema: fix an issue in sheet cross-references of global labels.
Commit 5ca34147 (a cherry pick from master branch) broke these cross-references.
If was fixed later in master branch, but these changes cannot be cherry picked.
So the old code is reused in 2 functions to fix the issue.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/18534
2024-11-17 13:11:23 +01:00
Seth Hillbrand b10ab478bd Fix 3D viewer omission of STEP models with relative path assignment
The project was not assigned to the board in the 3D viewer frame,
resulting in a failure to locate the relative path for STEP models.
To fix this, the current project should be assigned to the board in
the 3D viewer frame.

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


(cherry picked from commit d2e51fdb5f)

c824484c Fix 3D viewer omission of STEP models with relative path assignment

Co-authored-by: Dhineshkumar S <dhineshkumar@cgvakindia.com>
2024-11-17 07:21:14 +00:00
Wayne Stambaugh 710b6adb8c Warn user when template field names contain trailing/leading white space.
When loading a schematic that contains fields with trailing/leading white
space, show an infobar message.  When editing the template field names,
prompt the user to keep or remove any trailing or leading white space
characters from field names.

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

(cherry picked from commit d9d984d2c8)
2024-11-16 20:51:03 -06:00
Mark Roszko 6a01bdbabd Drop the first point of an arc when building an outline when there's a previous point that's being changed
Fixes https://gitlab.com/kicad/code/kicad/-/issues/18125


(cherry picked from commit 8b4253cda4)

Co-authored-by: Marek Roszko <mark.roszko@gmail.com>
2024-11-16 08:53:01 +00:00
Jeff Young 76e19c6dcf Import PCB into existing project.
Or, to be more direct: don't pull the project rug
out from under EESchema when importing in non-
stand-alone mode.

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

(cherry picked from commit a2f7edde2e)
2024-11-16 02:43:13 -06:00
Seth Hillbrand 8af289c33e Fix error in PointInside
If we are checking a point that is inline with multiple segments, we
were counting both the entry and exit as crossings, leading to points
inside a polygon being registered as outside.  Changing the conditional
to only catch one crossing as required.

Adds a QA check to ensure that this remains fixed

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

(cherry picked from commit 7916b1ddb8)
2024-11-16 02:38:49 -06:00
JamesJCode 35fa7db5c7 Don't reset sheet / screen file names if cancelling repeat insert
in recursive state

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

(cherry picked from commit c05dd18613)
2024-11-16 02:36:23 -06:00
Seth Hillbrand 67739ee3d1 Convert courtyards with error allowance
We convert arcs/circles to polygons with an allowable error.  This means
that the segments might end up being closer than we expect and we should
allow for this deviation when checking courtyards

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

(cherry picked from commit 3a8a5bb378)
2024-11-16 02:34:53 -06:00
Seth Hillbrand d8ba7284a8 Correct pad connections for 45° circular
When calculating the pad bbox, we need to only account for deflation of
zone min width.  Additionally, when calculating spokes for roughly
circular elements, we don't need to go to the bbox corners, so special
case it to rotate after the fact

Fixes https://gitlab.com/kicad/code/kicad/-/issues/18329
2024-11-16 02:34:25 -06:00
Seth Hillbrand fdc0309592 Simplify spoke generation
Sin/Cos are pre-caclulated for all multiples of 45° so we don't need to
short circuit them here.  Calculating the bbox intersection point allows
us to pick spoke sizes that are not overly large so as to miss the hit
point testing in the associated fill areas.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/18329
2024-11-16 02:34:25 -06:00
Mike Williams 55d77f0dbb pcb: fix crash on routing many traces
Further improvements could be made to the behavior of the autoroute
functionality in this case, but not crashing is a good start.

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/18328
(cherry picked from commit 04ff715945)
2024-11-16 02:32:33 -06:00
Seth Hillbrand 14fafebbc7 Handled unconnected nets
These nets may have only a single element in them (no connections), so
be sure to leave the node even without Features

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

(cherry picked from commit 14ccadd2a9)
2024-11-16 02:31:06 -06:00
Seth Hillbrand 7ca472deb8 Handle error when we don't have Eagle Board
This can also occur in libraries, so ensure we're not dereferencing a
null board pointer

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

(cherry picked from commit 89b9b13e21)
2024-11-16 02:30:36 -06:00
Seth Hillbrand fdb3612565 Some fixes for DXF import
In order to find elements, we need to have bbox correctly set.  ::min()
for doubles, just gives the smallest positive value.  So negative placed
graphics don't trigger the right bbox and they get nopped out of
existence.

Similarly, following the advice from @msteinbeck, we elevate the degree
of the spline before converting it to beziers in order to properly
represent in KiCad

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

(cherry picked from commit e0fc7b2b88)
2024-11-16 02:30:03 -06:00
Seth Hillbrand bf59a6305a Handle DXF files with out of bounds values
First, ensure that we calculate the bbox of the imported elements.

If the total BBOX is outside our allowed value, refused to import.  This
needs to be scaled or addressed in an external editor

If the bbox fits, then make sure that we clamp it such that the largest
element is still within our bounds

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

(cherry picked from commit a724b3d8b1)
2024-11-16 02:29:19 -06:00
Dhineshkumar S 17db770d92 Fix copy and paste issue in bus alias definition
Previously, creating a new member row by pasting text from the clipboard
did not trigger a cell value change which prevented the correct
association of the member value with the alias. To ensure this, we force
the member to be updated with the current alias before closing the dialog,
as well as with the previous alias when adding a new one

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

(cherry picked from commit cd40c6bbbf)
2024-11-16 02:27:26 -06:00
Dhineshkumar S b3004c9d96 Disable custom color selection when Fill Mode is Body Background Color
Currently, the system allows custom color selection for the Fill Color
property in the Properties toolbar even when Fill Mode is set to Body
Background Color via the Properties window. However, this does not update
the color to match the Body Background color. To fix this, custom color
selection for Fill Color will be disabled when Body Background Color is
chosen.

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

(cherry picked from commit cb41f39045)
2024-11-16 02:09:46 -06:00
Dhinesh c54ebdecd2 Fix missing text and graphics in PDFs generated by "Plot to PDF"
The "Plot to PDF" function was producing PDF files that lacked text and
graphic items in viewers like Adobe and Foxit. This issue was caused by
the use of the %g format specifier for floating-point numbers defined in
the PDF specification when writing text and drawing shapes in the PDF.
This incorrect format led to a "Too Few Operands" error during rendering.
To resolve this issue, all floating-point numbers must be specified in
fixed-point format according to the PDF specification wherever the issue
was generated.

Fixes #16465

(cherry picked from commit 8851cd77ab)
2024-11-16 02:08:50 -06:00
Ian McInerney 6fc15ed8df Make instance checker path globally writable
On Linux, this directory is shared between users, so a multi-user
machine needs to let the other users have access to the directory to
create their own lockfiles.

(cherry picked from commit 921358b096)
2024-11-16 01:43:18 -06:00
John Beard e7779d9b91 Exclude letter hotkeys from Shift fallback
From master branch

There is a fallback mechanism here designed to catch cases
where a hotkey is bound to a key that needs Shift to be
input (e.g. ? requires Shift on many non-US keyboards,
but the hotkey for that should be '?', not 'Shift+/'). For any key
where the two options are equally-valid "main" key (e.g. '6' and '^'
or '?' and '/' or ':' amd ';'), this is correct, as it allows
the hotkey to be simply the character in question.

Letters don't require this treatment - using this fallback
in the letter case means that a hotkey bound to 'B' will
also fire when 'Shift+B' is pressed, even when Shift+B is
bound to something else. In fact, it could even preempt the
real Shift+B hotkey.

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/19093
2024-11-13 19:50:48 +01:00
jean-pierre charras 06a91637a7 3D viewer: Ensure the 3D display view is not modified after left clicking.
After opening a context menu and left clicking on the 3D canvas, the view
was modified because a drag event was generated, probably a wxWidgets bug.
From master branch.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/17422
2024-11-11 17:11:07 +01:00
Alex Shvartzkop 08e9ce2828 Fix an "unreferenced local variable" warning, 2024-11-11 00:03:34 +03:00
Wayne Stambaugh 24f82ab87d Another attempt to fix Windows file URLs for PDF links.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14250

(cherry picked from commit 6cc5d89838)
2024-11-10 10:17:27 -05:00
Wayne Stambaugh bcf069699d Fix PDF plotter URI issues.
Add 'file:' URI JavaScript handlers.

Properly convert Windows file paths to valid URI syntax.

Use expanded variables for URI menu names.

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

(cherry picked from commit 930407fac8)
2024-11-08 14:55:40 -05:00
Wayne Stambaugh f8d694e4d0 Substitute variables in PDF plotter URI links and add file:// URI handler.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14250

(cherry picked from commit 43c3cd57eb)
2024-11-08 14:55:19 -05:00
John Beard b80334baa1 Libgit2: the const git_commit* saga continues
The change wasn't re-reverted in 1.8.3, it was just not
included. It was than _also_ reverted in 1.8.4, as it was for
1.8.2 (those two tags are on different branches - main and maint/v1.8).

Hopefully, this means that we're done here, and v1.8.5 will also be
const-y, whether it is based on main or maint/v1.8.

The current state of play:

* 1.7.0 and older: const
* 1.8.0, 1.8.1:    no const
* 1.8.2:           const
* 1.8.3:           no const
* 1.8.4:           const
Future:
* 1.8.5/1.9.0:     presumably/hopefully, const

This is currently breaking at least Arch and Fedora Rawhide

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/19062
(cherry picked from commit 9f579f787b)
2024-11-08 08:24:59 +08:00
Jan Wichmann 6c359e2f06 Fix: Clear drill holes table before loading board file
From master branch
2024-11-07 16:56:18 +01:00
Jeff Young a3eff548b7 Even the orphaned net must obey the min board clearance.
(And other Default netclass constraints.)

(cherry picked from commit 5d656e3c8d)

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/19051
2024-11-05 21:02:23 +08:00
Mark Roszko e33a732371 Bump vcpkg and wxwidgets for aui patch 2024-11-02 19:23:47 +00:00
Jon Evans 95d3200a3a Clear unknown keys from environment variable maps on save
Also fix the previous code for clearing unknown keys to use
a JSON pointer so that it functions correctly when the JSON path
is more than one level deep.

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


(cherry picked from commit 09652efec5)

Co-authored-by: Jon Evans <jon@craftyjon.com>
2024-11-02 18:54:12 +00:00
Jon Evans 5ee7ae4a45 Make sure to set modified bit when releasing nested settings
(cherry picked from commit 826794469d)
2024-11-02 10:26:03 -04:00
Jon Evans b13a9e231b Use a persistent flag to track JSON modifications
(cherry picked from commit eb6d85bacf)
2024-11-02 10:25:59 -04:00
Seth Hillbrand 1011f361fd Update translations 2024-11-01 16:27:28 -07:00
David Chorváth 288a08b9c2 Translated using Weblate (Slovak)
Currently translated at 65.0% (5974 of 9190 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/sk/
2024-11-02 00:26:56 +01:00
ZbeeGin cac1979f61 Translated using Weblate (Polish)
Currently translated at 100.0% (9190 of 9190 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/pl/
2024-11-02 00:26:56 +01:00
Pferd O 38a9477423 Translated using Weblate (German)
Currently translated at 100.0% (9190 of 9190 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/de/
2024-11-02 00:26:56 +01:00
David Chorváth 072446e79d Translated using Weblate (Slovak)
Currently translated at 64.8% (5961 of 9190 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/sk/
2024-11-02 00:26:56 +01:00
Pferd O 4fc528819d Translated using Weblate (German)
Currently translated at 99.9% (9187 of 9190 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/de/
2024-11-02 00:26:56 +01:00
CloverGit d5f52000ce Translated using Weblate (Chinese (Simplified Han script))
Currently translated at 100.0% (9190 of 9190 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/zh_Hans/
2024-11-02 00:26:56 +01:00
Henrik Kauhanen 8e4d7da4ea Translated using Weblate (Swedish)
Currently translated at 99.9% (9189 of 9190 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/sv/
2024-11-02 00:26:55 +01:00
Henrik Kauhanen ea3f0bada4 Translated using Weblate (Swedish)
Currently translated at 99.9% (9189 of 9190 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/sv/
2024-11-02 00:26:55 +01:00
co8 j 3b33ce8bcc Translated using Weblate (Japanese)
Currently translated at 100.0% (9190 of 9190 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/ja/
2024-11-02 00:26:55 +01:00
Pferd O 74b42f1bb2 Translated using Weblate (German)
Currently translated at 99.9% (9187 of 9190 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/de/
2024-11-02 00:26:55 +01:00
Pferd O b455a4cd54 Translated using Weblate (German)
Currently translated at 99.9% (9187 of 9190 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/de/
2024-11-02 00:26:55 +01:00
co8 j 5021f6ee26 Translated using Weblate (Japanese)
Currently translated at 100.0% (9190 of 9190 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/ja/
2024-11-02 00:26:55 +01:00
sergio 0be2b88f5a Translated using Weblate (Russian)
Currently translated at 99.9% (9187 of 9190 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/ru/
2024-11-02 00:26:55 +01:00
Wellington Terumi Uemura f3a57cf763 Translated using Weblate (Portuguese (Brazil))
Currently translated at 100.0% (9190 of 9190 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/pt_BR/
2024-11-02 00:26:55 +01:00
Pferd O ddd69019bc Translated using Weblate (German)
Currently translated at 99.9% (9187 of 9190 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/de/
2024-11-02 00:26:55 +01:00
109247019824 94e34cb1eb Translated using Weblate (Bulgarian)
Currently translated at 7.6% (706 of 9190 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/bg/
2024-11-02 00:26:55 +01:00
JamesJCode 6470212edd Fix missed rows when pasting to WX_GRID on macOS
Fixes https://gitlab.com/kicad/code/kicad/-/issues/18916

(cherry picked from commit 816af9562b)
2024-11-01 23:10:26 +00:00
Mike Williams 8c3bcade1c schematic: fix missing actions strings and hotkey conflict
Fixes: https://gitlab.com/kicad/code/kicad/-/issues/17694
(cherry picked from commit 5ed80a08b8)

Fixes https://gitlab.com/kicad/code/kicad/-/issues/18748
2024-11-01 13:37:53 -07:00
jean-pierre charras 70e99acce6 FP editor: fix possible crash when saving a footprint due to a null pointer
From master branch

Fixes https://gitlab.com/kicad/code/kicad/-/issues/19018
2024-11-01 20:56:42 +01:00
jean-pierre charras 25be138ac1 eeschema, DIALOG_SHEET_PROPERTIES: add test for valid sheet filename
From master branch

Fixes https://gitlab.com/kicad/code/kicad/-/issues/18981
2024-11-01 20:24:50 +01:00
Alex Shvartzkop 9f196d2e64 EasyEDA/LCEDA: import bezier curves in symbols.
See https://gitlab.com/kicad/code/kicad/-/issues/19034
2024-11-01 16:36:45 +03:00
Alex Shvartzkop b51fed4118 EasyEDA/LCEDA Pro: don't import empty but visible netlabels.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/19034
2024-11-01 16:10:15 +03:00
JamesJCode a914f361d3 Fix libgit integration for version >= 1.8.3
The API continues to change...

(cherry picked from commit 75c2f17b42)
2024-10-31 18:48:10 +00:00
Alex Shvartzkop 846b634e0e EasyEDA/LCEDA import: take symbol/netport Name from device entry if empty in schematic.
Also fixes netport orientation if it's symbol is non-default.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/19021
2024-10-30 18:33:42 +03:00
Alex Shvartzkop 08b54e205d Show failing strings in HTMLEscape test.
(cherry picked from commit 0581423d50)
2024-10-30 10:37:01 +03:00
Alex Shvartzkop 7cba1e1a55 Update field order in PCB_TUNING_PATTERN.
(cherry picked from commit d2c33e186e)
2024-10-30 10:36:53 +03:00
Alex Shvartzkop 6ae334a751 Fix/improve HTML unescape function.
Also adds some tests.
2024-10-30 08:22:38 +03:00
Alex Shvartzkop 61687e8499 QA: do not pass negative char values to isdigit in NUMERIC_EVALUATOR.
This causes an assert failure on MSVC when running qa_common.
2024-10-30 08:22:38 +03:00
Seth Hillbrand e014f2274f Fix display of broken fonts
TTF fonts are supposed to obey a specific winding.  But sometimes they
don't, especially with garbage windows font editing programs.  If the
outline with hole winding doesn't have an outline, it is probably an
outline itself

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

(cherry picked from commit a6b25d1ee1)
2024-10-29 11:02:26 -07:00
Jeff Young 7e0f05f991 Must check for implicit min separately from opt/max.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/19012

(cherry picked from commit 7074c31374)
2024-10-29 17:01:45 +00:00
Jeff Young 1e21b41be5 Centralize ref-des error checking.
(cherry picked from commit 905eaa79a9)
2024-10-28 19:03:50 +00:00
Mark Roszko 4a7dcfdd1f Update vcpkg.json 2024-10-27 23:43:15 +00:00
Alex Shvartzkop d1684b8a72 Fix compatibility with LCEDA/EasyEDA v2.2.32
Now device attributes can contain numbers.

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

(cherry picked from commit 840b9aebba)
2024-10-27 04:30:59 +03:00
Troy Denton 8da026baff Fix URI environment variable expansion issue.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/18918

(cherry picked from commit 0f33aebe48)
2024-10-24 11:53:41 -04:00
jean-pierre charras 89a3ead51e Pcbnew: fix text position when drawing PCB_TEXTs on non paired layers
For these texts, and when the view was "flip board view" option, these text
positions were incorrectly calculated for texts having a text rotation not 0.
From master branch

Fixes https://gitlab.com/kicad/code/kicad/-/issues/18980
2024-10-24 15:20:33 +02:00
jean-pierre charras 5064834716 French translation update 2024-10-24 14:09:49 +02:00
Seth Hillbrand 51a3859d7e Preserve pin numbering when duplicating
We renumber duplicated pins but the previous order was essentially
random.  This keeps the numeric order of the pins on the screen, falling
back to position if they are not numbered

(cherry picked from commit f4bec843d4)
2024-10-21 14:00:18 -07:00
Seth Hillbrand bf37bd8ed5 Fix DRC error with arcs
When two arcs only barely overlapped, we cannot predict the actual point
ends as they exist in the error margins.  Since arc tracks have
different radii by definition, rounding errors in calculating the
overlap angle led to some mistaken identification of parallel segments.

This adds an advanced config flag to set the preferred cutoff point
(currently 0.001°) for whether two arcs actually overlap in shared angle
space

(cherry picked from commit 6be6680d8c)
2024-10-21 13:41:25 -07:00
Dhineshkumar S 283fed83c3 Fix Focus Issue in Parent Window After Hiding the Search Panel
Previously, when the search panel was hidden, the focused search control
did not lose focus, causing an inability to focus on any items in the
parent window when using shortcut keys. This forces correct focus back to the edit window

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

(cherry picked from commit 2bee6f2549)
2024-10-21 13:36:29 -07:00
jean-pierre charras 48983dd31d Python script: Ensure image handlers are loaded before loading a board,.
because a board can include bitmap images using various formats, all
available image handlers must be loaded.
From master branch

Fixes https://gitlab.com/kicad/code/kicad/-/issues/18959
2024-10-21 17:33:14 +02:00
jean-pierre charras ccd4b0cf05 pagelayout_editor: lock panel update during widgets rebuild.
The rebuild is much faster.
From master branch
2024-10-21 17:21:04 +02:00
aris-kimi 154c755a1b Fix non working Esc when init Polyline Properties dialog.
Fixes: https://gitlab.com/kicad/code/kicad/-/issues/18850
(cherry picked from commit 36bac3f467)
2024-10-20 12:53:34 +01:00
Jeff Young 4157d3350e Limit fix to MacOS.
GTK definitely doesn't need it.  It's unlikely that
MSW needs it either.
2024-10-19 16:49:21 +01:00
Jeff Young 08ba185003 Make sure Paste can't leak through modal dialog.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/18912

(cherry picked from commit f1ff75f969)
2024-10-19 16:49:21 +01:00
Jeff Young 7b0e5cd080 DRCEpsilon will appear on *both* sides of a zone neck.
Also don't hide modification of minWidth as a side-effect
of an if-statement.

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

(cherry picked from commit b342126ff3)
2024-10-19 16:49:21 +01:00
Jeff Young 66f50d0c0b A neck in a zone fill will be DRCEpsilon smaller on each side.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/18921

(cherry picked from commit 4089735c28)
2024-10-19 16:49:21 +01:00
Jeff Young 973d2d6c03 Even the orphaned net must obey the min board clearance.
(And other Default netclass constraints.)

(cherry picked from commit 4601503660)
2024-10-19 16:49:21 +01:00
Jeff Young fa854b80da Don't ask about locking twice.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/18679

(cherry picked from commit a9f79093be)
2024-10-19 16:49:21 +01:00
Jeff Young 05f8bc05ec Fix broken logic.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/18580

(cherry picked from commit e5321f7401)
2024-10-19 16:49:21 +01:00
Jeff Young d9af68b910 Report implicit rule minimums as being from the board setup.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/18642

(cherry picked from commit ed268c5701)
2024-10-19 16:49:21 +01:00
Seth Hillbrand 0c8172880f Prevent soldermask bridge DRC error with mask pad
We checked logical pad matching when looking at pad-based mask but we
should also do the same for aperture masks
2024-10-18 15:24:21 -07:00
Seth Hillbrand 45559cb809 Update translations 2024-10-16 15:32:27 -07:00
Ivan Chuba d3e1d94046 Translated using Weblate (Ukrainian)
Currently translated at 87.0% (7998 of 9190 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/uk/
2024-10-17 00:31:56 +02:00
Jan Straka 2c75396b80 Translated using Weblate (Czech)
Currently translated at 84.1% (7735 of 9190 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/cs/
2024-10-17 00:31:56 +02:00
Arnau Llovet Vidal 7aae0a9f65 Translated using Weblate (Catalan)
Currently translated at 47.4% (4365 of 9190 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/ca/
2024-10-17 00:31:56 +02:00
Flórián Fuszkó bfd6d96ffc Translated using Weblate (Hungarian)
Currently translated at 3.4% (320 of 9190 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/hu/
2024-10-17 00:31:56 +02:00
Pferd O f4efa47fe7 Translated using Weblate (German)
Currently translated at 99.9% (9187 of 9190 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/de/
2024-10-17 00:31:56 +02:00
co8 j d1fd8b18ad Translated using Weblate (Japanese)
Currently translated at 100.0% (9190 of 9190 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/ja/
2024-10-17 00:31:56 +02:00
Karl SCHUH 5ee1c0ab42 Translated using Weblate (German)
Currently translated at 99.9% (9187 of 9190 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/de/
2024-10-17 00:31:56 +02:00
co8 j 8d53326021 Translated using Weblate (Japanese)
Currently translated at 100.0% (9190 of 9190 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/ja/
2024-10-17 00:31:55 +02:00
CloverGit 246afee56e Translated using Weblate (Chinese (Simplified Han script))
Currently translated at 100.0% (9190 of 9190 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/zh_Hans/
2024-10-17 00:31:55 +02:00
taotieren 352faf526f Translated using Weblate (Chinese (Simplified Han script))
Currently translated at 99.9% (9187 of 9190 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/zh_Hans/
2024-10-17 00:31:55 +02:00
Wellington Terumi Uemura c183a63c50 Translated using Weblate (Portuguese (Brazil))
Currently translated at 100.0% (9190 of 9190 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/pt_BR/
2024-10-17 00:31:55 +02:00
Pferd O 9c34432b99 Translated using Weblate (German)
Currently translated at 99.9% (9187 of 9190 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/de/
2024-10-17 00:31:55 +02:00
CloverGit 76bc0e27fc Translated using Weblate (Chinese (Simplified Han script))
Currently translated at 99.9% (9187 of 9190 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/zh_Hans/
2024-10-17 00:31:55 +02:00
Petr Pazourek b2f6d341dd Translated using Weblate (Czech)
Currently translated at 84.1% (7735 of 9190 strings)

Translation: KiCad EDA/v8
Translate-URL: https://hosted.weblate.org/projects/kicad/v8/cs/
2024-10-17 00:31:55 +02:00
JamesJCode 7b5afe805e Drag NC markers attached to SCH_SHEET pins when SCH_SHEET is dragged
Fixes https://gitlab.com/kicad/code/kicad/-/issues/18854

(Cherry-picked from commit d726097a3f)
2024-10-14 00:02:05 +01:00
Wayne Stambaugh b77a591c45 Begin version 8.0.7 development. 2024-10-13 18:20:51 -04:00
368 changed files with 104634 additions and 85374 deletions
+1 -1
View File
@@ -229,7 +229,7 @@ void BOARD_ADAPTER::ReloadColorSettings() noexcept
try
{
cfg = Pgm().GetSettingsManager().GetAppSettings<PCBNEW_SETTINGS>();
cfg = Pgm().GetSettingsManager().GetAppSettings<PCBNEW_SETTINGS>( "pcbnew" );
}
catch( const std::runtime_error& e )
{
@@ -98,6 +98,7 @@ void BOARD_ADAPTER::addText( const EDA_TEXT* aText, CONTAINER_2D_BASE* aContaine
TEXT_ATTRIBUTES attrs = aText->GetAttributes();
float penWidth_3DU = TO_3DU( aText->GetEffectiveTextPenWidth() );
KIFONT::FONT* font = aText->GetFont();
wxString shownText = aText->GetShownText( true );
if( !font )
font = KIFONT::FONT::GetFont( wxEmptyString, aText->IsBold(), aText->IsItalic() );
@@ -132,8 +133,15 @@ void BOARD_ADAPTER::addText( const EDA_TEXT* aText, CONTAINER_2D_BASE* aContaine
attrs.m_Angle = aText->GetDrawRotation();
font->Draw( &callback_gal, aText->GetShownText( true ), aText->GetDrawPos(), attrs,
aOwner->GetFontMetrics() );
if( auto* cache = aText->GetRenderCache( font, shownText ) )
{
callback_gal.DrawGlyphs( *cache );
}
else
{
font->Draw( &callback_gal, shownText, aText->GetDrawPos(), attrs,
aOwner->GetFontMetrics() );
}
}
}
+5
View File
@@ -752,6 +752,11 @@ void EDA_3D_CANVAS::OnLeftDown( wxMouseEvent& event )
SetFocus();
stop_editingTimeOut_Timer();
// Ensure m_camera.m_lastPosition (current mouse position) is up to date for
// future drag events (can be not the case when left clicking after
// opening a context menu)
OnMouseMoveCamera( event );
if( !event.Dragging() && ( m_3d_render_raytracing != nullptr ) )
{
RAY mouseRay = getRayAtCurrentMousePosition();
+3 -2
View File
@@ -216,6 +216,8 @@ public:
*/
void DoRePaint();
void OnCloseWindow( wxCloseEvent& event );
private:
// The wxPaintEvent event. mainly calls DoRePaint()
void OnPaint( wxPaintEvent& aEvent );
@@ -226,14 +228,13 @@ private:
void OnMouseWheel( wxMouseEvent& event );
void OnMagnify( wxMouseEvent& event );
void OnMagnify( wxMouseEvent& event );
void OnMouseMove( wxMouseEvent& event );
void OnLeftDown( wxMouseEvent& event );
void OnLeftUp( wxMouseEvent& event );
void OnMiddleUp( wxMouseEvent& event );
void OnMiddleDown( wxMouseEvent& event );
void OnTimerTimeout_Editing( wxTimerEvent& event );
void OnCloseWindow( wxCloseEvent& event );
void OnResize( wxSizeEvent& event );
void OnTimerTimeout_Redraw( wxTimerEvent& event );
+2
View File
@@ -1,6 +1,8 @@
add_library(3d-viewer_navlib STATIC
"nl_3d_viewer_plugin.cpp"
"nl_3d_viewer_plugin_impl.cpp"
"nl_footprint_properties_plugin.cpp"
"nl_footprint_properties_plugin_impl.cpp"
)
# 3d-viewer_navlib depends on make_lexer outputs in common
+3 -6
View File
@@ -25,20 +25,17 @@
NL_3D_VIEWER_PLUGIN::NL_3D_VIEWER_PLUGIN( EDA_3D_CANVAS* aViewport )
: m_impl( nullptr )
{
if( ADVANCED_CFG::GetCfg().m_Use3DConnexionDriver
&& KIPLATFORM::DRIVERS::Valid3DConnexionDriverVersion() )
{
m_impl = new NL_3D_VIEWER_PLUGIN_IMPL( aViewport );
m_impl = std::make_unique<NL_3D_VIEWER_PLUGIN_IMPL>( aViewport, "KiCAD 3D" );
m_impl->Connect();
}
}
NL_3D_VIEWER_PLUGIN::~NL_3D_VIEWER_PLUGIN()
{
delete m_impl;
}
NL_3D_VIEWER_PLUGIN::~NL_3D_VIEWER_PLUGIN() = default;
void NL_3D_VIEWER_PLUGIN::SetFocus( bool focus )
+3 -1
View File
@@ -26,6 +26,8 @@
#ifndef NL_3D_VIEWER_PLUGIN_H_
#define NL_3D_VIEWER_PLUGIN_H_
#include <memory>
// Forward declarations.
class EDA_3D_CANVAS;
class NL_3D_VIEWER_PLUGIN_IMPL;
@@ -54,7 +56,7 @@ public:
void SetFocus( bool aFocus = true );
private:
NL_3D_VIEWER_PLUGIN_IMPL* m_impl;
std::unique_ptr<NL_3D_VIEWER_PLUGIN_IMPL> m_impl;
};
#endif // NL_3D_VIEWER_PLUGIN_H_
@@ -1,8 +1,8 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2021 3Dconnexion
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2024 3Dconnexion
* Copyright (C) 2024 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@@ -27,6 +27,7 @@
// KiCAD includes
#include <tool/action_manager.h>
#include <tool/tool_manager.h>
#include <tool/tools_holder.h>
// stdlib
#include <map>
@@ -72,7 +73,7 @@ bool equals( glm::mat<L, C, T, Q> const& aFirst, glm::mat<L, C, T, Q> const& aSe
}
NL_3D_VIEWER_PLUGIN_IMPL::NL_3D_VIEWER_PLUGIN_IMPL( EDA_3D_CANVAS* aCanvas ) :
NL_3D_VIEWER_PLUGIN_IMPL::NL_3D_VIEWER_PLUGIN_IMPL( EDA_3D_CANVAS* aCanvas, const std::string& aProfileHint ) :
NAV_3D( false, false ),
m_canvas( aCanvas ),
m_capIsMoving( false ),
@@ -80,12 +81,7 @@ NL_3D_VIEWER_PLUGIN_IMPL::NL_3D_VIEWER_PLUGIN_IMPL( EDA_3D_CANVAS* aCanvas ) :
{
m_camera = dynamic_cast<TRACK_BALL*>( m_canvas->GetCamera() );
PutProfileHint( "KiCAD 3D" );
EnableNavigation( true );
PutFrameTimingSource( TimingSource::SpaceMouse );
exportCommandsAndImages();
PutProfileHint( aProfileHint );
}
@@ -101,8 +97,19 @@ void NL_3D_VIEWER_PLUGIN_IMPL::SetFocus( bool aFocus )
NAV_3D::Write( navlib::focus_k, aFocus );
}
// temporary store for the categories
typedef std::map<std::string, TDx::CCommandTreeNode*> CATEGORY_STORE;
EDA_3D_CANVAS* NL_3D_VIEWER_PLUGIN_IMPL::GetCanvas() const
{
return m_canvas;
}
void NL_3D_VIEWER_PLUGIN_IMPL::Connect()
{
EnableNavigation(true);
PutFrameTimingSource(TimingSource::SpaceMouse);
exportCommandsAndImages();
}
/**
* Add a category to the store.
@@ -571,7 +578,7 @@ long NL_3D_VIEWER_PLUGIN_IMPL::SetActiveCommand( std::string commandId )
if( parent->IsEnabled() )
{
TOOL_MANAGER* tool_manager = static_cast<PCB_BASE_FRAME*>( parent )->GetToolManager();
TOOL_MANAGER* tool_manager = dynamic_cast<TOOLS_HOLDER*>( parent )->GetToolManager();
if( tool_manager == nullptr )
{
+21 -4
View File
@@ -1,8 +1,8 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2021 3Dconnexion
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2024 3Dconnexion
* Copyright (C) 2024 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@@ -42,6 +42,11 @@
class EDA_3D_CANVAS;
class TRACK_BALL;
// temporary store for the categories
typedef std::map<std::string, TDx::CCommandTreeNode*> CATEGORY_STORE;
CATEGORY_STORE::iterator add_category( std::string aCategoryPath, CATEGORY_STORE& aCategoryStore );
// Convenience typedef.
typedef TDx::SpaceMouse::Navigation3D::CNavigation3D NAV_3D;
@@ -56,8 +61,9 @@ public:
* Initializes a new instance of the NL_3DVIEWER_PLUGIN.
*
* @param aCanvas is the viewport to be navigated.
* @param aProfileHint tells the 3DConnexion UI which profile to use.
*/
NL_3D_VIEWER_PLUGIN_IMPL( EDA_3D_CANVAS* aCanvas );
NL_3D_VIEWER_PLUGIN_IMPL( EDA_3D_CANVAS* aCanvas, const std::string& aProfileHint );
virtual ~NL_3D_VIEWER_PLUGIN_IMPL();
@@ -69,11 +75,21 @@ public:
*/
void SetFocus( bool aFocus = true );
/**
* Get the m_canvas pointer.
*/
EDA_3D_CANVAS* GetCanvas() const;
/**
* Connect plugin implementation to the driver.
*/
void Connect();
private:
/**
* Export the invocable actions and images to the 3Dconnexion UI.
*/
void exportCommandsAndImages();
virtual void exportCommandsAndImages();
long GetCameraMatrix( navlib::matrix_t& aMatrix ) const override;
long GetPointerPosition( navlib::point_t& aPosition ) const override;
@@ -111,6 +127,7 @@ private:
long GetCoordinateSystem( navlib::matrix_t& aMatrix ) const override;
long GetIsViewRotatable( navlib::bool_t& isRotatable ) const override;
private:
EDA_3D_CANVAS* m_canvas;
TRACK_BALL* m_camera;
@@ -0,0 +1,45 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2024 3Dconnexion
* Copyright (C) 2024 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "nl_footprint_properties_plugin.h"
#include "nl_footprint_properties_plugin_impl.h"
#include <advanced_config.h>
#include <kiplatform/drivers.h>
NL_FOOTPRINT_PROPERTIES_PLUGIN::NL_FOOTPRINT_PROPERTIES_PLUGIN( EDA_3D_CANVAS* aViewport )
{
if( ADVANCED_CFG::GetCfg().m_Use3DConnexionDriver
&& KIPLATFORM::DRIVERS::Valid3DConnexionDriverVersion() )
{
m_impl = std::make_unique<NL_FOOTPRINT_PROPERTIES_PLUGIN_IMPL>( aViewport );
m_impl->Connect();
}
}
NL_FOOTPRINT_PROPERTIES_PLUGIN::~NL_FOOTPRINT_PROPERTIES_PLUGIN() = default;
void NL_FOOTPRINT_PROPERTIES_PLUGIN::SetFocus( bool focus )
{
if( m_impl )
m_impl->SetFocus( focus );
}
@@ -0,0 +1,62 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2024 3Dconnexion
* Copyright (C) 2024 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* @file nl_footprint_properties_plugin.h
* @brief declaration of the nl_footprint_properties_plugin class
*/
#ifndef NL_FOOTPRINT_PROPERTIES_PLUGIN_H_
#define NL_FOOTPRINT_PROPERTIES_PLUGIN_H_
#include <memory>
// Forward declarations.
class EDA_3D_CANVAS;
class NL_FOOTPRINT_PROPERTIES_PLUGIN_IMPL;
/**
* The class that implements the public interface to the SpaceMouse plug-in.
*/
class NL_FOOTPRINT_PROPERTIES_PLUGIN
{
public:
/**
* Initializes a new instance of the NL_FOOTPRINT_PROPERTIES_PLUGIN.
*
* @param aViewport is the viewport to be navigated.
*/
NL_FOOTPRINT_PROPERTIES_PLUGIN( EDA_3D_CANVAS* aViewport );
virtual ~NL_FOOTPRINT_PROPERTIES_PLUGIN();
/**
* Set the connection to the 3Dconnexion driver to the focus state so that
* 3DMouse data is routed here.
*
* @param aFocus is true to set the connection active.
*/
void SetFocus( bool aFocus = true );
private:
std::unique_ptr<NL_FOOTPRINT_PROPERTIES_PLUGIN_IMPL> m_impl;
};
#endif // NL_FOOTPRINT_PROPERTIES_PLUGIN_H_
@@ -0,0 +1,162 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2024 3Dconnexion
* Copyright (C) 2024 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "nl_footprint_properties_plugin_impl.h"
#include <3d-viewer/3d_canvas/eda_3d_canvas.h>
// KiCAD includes
#include <tool/action_manager.h>
#include <tool/tool_manager.h>
#include <tool/tools_holder.h>
#include <wx/mstream.h>
#define BOUNDING_BOX_SCALE_FACTOR 1.3f
/**
* Flag to enable the NL_FOOTPRINT_PROPERTIES_PLUGIN debug tracing.
*
* Use "KI_TRACE_NL_FOOTPRINT_PROPERTIES_PLUGIN" to enable.
*
* @ingroup trace_env_vars
*/
const wxChar* NL_FOOTPRINT_PROPERTIES_PLUGIN_IMPL::m_logTrace =
wxT( "KI_TRACE_NL_FOOTPRINT_PROPERTIES_PLUGIN" );
NL_FOOTPRINT_PROPERTIES_PLUGIN_IMPL::NL_FOOTPRINT_PROPERTIES_PLUGIN_IMPL(EDA_3D_CANVAS* aCanvas) :
NL_3D_VIEWER_PLUGIN_IMPL(aCanvas, "KiCAD Footprint Properties")
{}
long NL_FOOTPRINT_PROPERTIES_PLUGIN_IMPL::GetModelExtents( navlib::box_t& extents ) const
{
SFVEC3F min = NL_3D_VIEWER_PLUGIN_IMPL::GetCanvas()->GetBoardAdapter().GetBBox().Min();
SFVEC3F max = NL_3D_VIEWER_PLUGIN_IMPL::GetCanvas()->GetBoardAdapter().GetBBox().Max();
SFVEC3F diff = ( BOUNDING_BOX_SCALE_FACTOR - 1.f ) / 2.f * ( max - min );
min -= diff;
max += diff;
extents = { min.x, min.y, min.z, max.x, max.y, max.z };
return 0;
}
void NL_FOOTPRINT_PROPERTIES_PLUGIN_IMPL::exportCommandsAndImages()
{
std::list<TOOL_ACTION*> actions = ACTION_MANAGER::GetActionList();
if( actions.size() == 0 )
{
return;
}
using TDx::SpaceMouse::CCommand;
using TDx::SpaceMouse::CCommandSet;
// The root action set node
CCommandSet commandSet( "EDA_3D_CANVAS", "3D Viewer" );
// Activate the command set
NAV_3D::PutActiveCommands( commandSet.GetId() );
// temporary store for the categories
CATEGORY_STORE categoryStore;
std::vector<TDx::CImage> vImages;
// add the action set to the category_store
categoryStore.insert( categoryStore.end(), CATEGORY_STORE::value_type( ".", &commandSet ) );
std::list<TOOL_ACTION*>::const_iterator it;
for( it = actions.begin(); it != actions.end(); ++it )
{
const TOOL_ACTION* action = *it;
std::string label = action->GetMenuLabel().ToStdString();
if( label.empty() )
{
continue;
}
std::string name = action->GetName();
// Do no export commands for the pcbnew app.
if( name.rfind( "pcbnew.", 0 ) == 0 )
{
continue;
}
// Exclude commands which can't be used in the footprint properties.
if( name.rfind( "3DViewer.Control.pivotCenter", 0 ) == 0
|| name.rfind( "3DViewer.Control.material", 0 ) == 0
|| name.rfind( "3DViewer.Control.attribute", 0 ) == 0
|| name.rfind( "3DViewer.Control.show", 0 ) == 0 )
{
continue;
}
std::string strCategory = action->GetToolName();
CATEGORY_STORE::iterator iter = categoryStore.find( strCategory );
if( iter == categoryStore.end() )
{
iter = add_category( std::move( strCategory ), categoryStore );
}
std::string description = action->GetDescription().ToStdString();
// Arbitrary 8-bit data stream
wxMemoryOutputStream imageStream;
if( action->GetIcon() != BITMAPS::INVALID_BITMAP )
{
wxImage image = KiBitmap( action->GetIcon() ).ConvertToImage();
image.SaveFile( imageStream, wxBitmapType::wxBITMAP_TYPE_PNG );
image.Destroy();
if( imageStream.GetSize() )
{
wxStreamBuffer* streamBuffer = imageStream.GetOutputStreamBuffer();
TDx::CImage tdxImage = TDx::CImage::FromData( "", 0, name.c_str() );
tdxImage.AssignImage( std::string( reinterpret_cast<const char*>(
streamBuffer->GetBufferStart() ),
streamBuffer->GetBufferSize() ),
0 );
wxLogTrace( m_logTrace, wxT( "Adding image for : %s" ), name );
vImages.push_back( std::move( tdxImage ) );
}
}
wxLogTrace( m_logTrace, wxT( "Inserting command: %s, description: %s, in category: %s" ),
name, description, iter->first );
iter->second->push_back(
CCommand( std::move( name ), std::move( label ), std::move( description ) ) );
}
NAV_3D::AddCommandSet( commandSet );
NAV_3D::AddImages( vImages );
}
@@ -0,0 +1,68 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2024 3Dconnexion
* Copyright (C) 2024 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* @file nl_footprint_properties_plugin_impl.h
* @brief declaration of the nl_footprint_properties_plugin_impl class
*/
#ifndef NL_FOOTPRINT_PROPERTIES_PLUGIN_IMPL_H_
#define NL_FOOTPRINT_PROPERTIES_PLUGIN_IMPL_H_
#include "nl_3d_viewer_plugin_impl.h"
// TDxWare SDK.
#include <SpaceMouse/CNavigation3D.hpp>
/**
* The class that adjusts NL_3D_VIEWER_PLUGIN_IMPL implementation for 3D Model preview in footprint properties dialog.
*/
class NL_FOOTPRINT_PROPERTIES_PLUGIN_IMPL : public NL_3D_VIEWER_PLUGIN_IMPL
{
public:
/**
* Initializes a new instance of the NL_FOOTPRINT_PROPERTIES_PLUGIN.
*
* @param aCanvas is the viewport to be navigated.
*/
NL_FOOTPRINT_PROPERTIES_PLUGIN_IMPL( EDA_3D_CANVAS* aCanvas );
private:
/**
* Get Footprint 3D Model extents.
*
* @param extents is the box around the 3D model.
*/
long GetModelExtents( navlib::box_t& extents ) const override;
/**
* Export the invocable actions and images to the 3Dconnexion UI.
*/
void exportCommandsAndImages() override;
private:
/**
* Trace mask used to enable or disable the trace output of this class.
* The debug output can be turned on by setting the WXTRACE environment variable to
* "KI_TRACE_NL_FOOTPRINT_PROPERTIES_PLUGIN". See the wxWidgets documentation on wxLogTrace for
* more information.
*/
static const wxChar* m_logTrace;
};
#endif // NL_FOOTPRINT_PROPERTIES_PLUGIN_IMPL_H_
@@ -1243,8 +1243,6 @@ void RENDER_3D_RAYTRACE::load3DModels( CONTAINER_3D& aDstContainer, bool aSkipMa
fpMatrix, SFVEC3F( modelunit_to_3d_units_factor, modelunit_to_3d_units_factor,
modelunit_to_3d_units_factor ) );
BOARD_ITEM* boardItem = dynamic_cast<BOARD_ITEM*>( fp );
// Get the list of model files for this model
S3D_CACHE* cacheMgr = m_boardAdapter.Get3dCacheManager();
auto sM = fp->Models().begin();
@@ -1304,7 +1302,7 @@ void RENDER_3D_RAYTRACE::load3DModels( CONTAINER_3D& aDstContainer, bool aSkipMa
SFVEC3F( sM->m_Scale.x, sM->m_Scale.y, sM->m_Scale.z ) );
addModels( aDstContainer, modelPtr, modelMatrix, (float) sM->m_Opacity,
aSkipMaterialInformation, boardItem );
aSkipMaterialInformation, fp );
}
}
+10 -7
View File
@@ -113,7 +113,7 @@ EDA_3D_VIEWER_FRAME::EDA_3D_VIEWER_FRAME( KIWAY* aKiway, PCB_BASE_FRAME* aParent
SetStatusWidths( arrayDim( status_dims ), status_dims );
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EDA_3D_VIEWER_SETTINGS* cfg = mgr.GetAppSettings<EDA_3D_VIEWER_SETTINGS>();
EDA_3D_VIEWER_SETTINGS* cfg = mgr.GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" );
ANTIALIASING_MODE aaMode = static_cast<ANTIALIASING_MODE>( cfg->m_Render.opengl_AA_mode );
m_canvas = new EDA_3D_CANVAS( this, OGL_ATT_LIST::GetAttributesList( aaMode ), m_boardAdapter,
@@ -479,7 +479,7 @@ void EDA_3D_VIEWER_FRAME::Process_Special_Functions( wxCommandEvent &event )
case ID_MENU3D_RESET_DEFAULTS:
{
auto cfg = Pgm().GetSettingsManager().GetAppSettings<EDA_3D_VIEWER_SETTINGS>();
auto cfg = Pgm().GetSettingsManager().GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" );
cfg->ResetToDefaults();
LoadSettings( cfg );
@@ -561,8 +561,8 @@ void EDA_3D_VIEWER_FRAME::LoadSettings( APP_SETTINGS_BASE *aCfg )
{
EDA_BASE_FRAME::LoadSettings( aCfg );
EDA_3D_VIEWER_SETTINGS* cfg = dynamic_cast<EDA_3D_VIEWER_SETTINGS*>( aCfg );
wxASSERT( cfg );
// Dynamic_cast here will fail on Mac when called from CvPCB.
EDA_3D_VIEWER_SETTINGS* cfg = static_cast<EDA_3D_VIEWER_SETTINGS*>( aCfg );
wxLogTrace( m_logTrace, wxT( "EDA_3D_VIEWER_FRAME::LoadSettings" ) );
@@ -570,6 +570,9 @@ void EDA_3D_VIEWER_FRAME::LoadSettings( APP_SETTINGS_BASE *aCfg )
{
applySettings( cfg );
if( !GetBoard()->GetProject() )
GetBoard()->SetProject( &Prj() );
m_boardAdapter.SetBoard( GetBoard() );
// When opening the 3D viewer, we use the OpenGL mode, never the ray tracing engine
@@ -603,7 +606,7 @@ void EDA_3D_VIEWER_FRAME::LoadSettings( APP_SETTINGS_BASE *aCfg )
void EDA_3D_VIEWER_FRAME::SaveSettings( APP_SETTINGS_BASE *aCfg )
{
auto cfg = Pgm().GetSettingsManager().GetAppSettings<EDA_3D_VIEWER_SETTINGS>();
auto cfg = Pgm().GetSettingsManager().GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" );
EDA_BASE_FRAME::SaveSettings( cfg );
@@ -639,7 +642,7 @@ void EDA_3D_VIEWER_FRAME::CommonSettingsChanged( bool aEnvVarsChanged, bool aTex
ReCreateMainToolbar();
loadCommonSettings();
applySettings( Pgm().GetSettingsManager().GetAppSettings<EDA_3D_VIEWER_SETTINGS>() );
applySettings( Pgm().GetSettingsManager().GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" ) );
m_appearancePanel->CommonSettingsChanged();
@@ -670,7 +673,7 @@ void EDA_3D_VIEWER_FRAME::ShowChangedLanguage()
void EDA_3D_VIEWER_FRAME::ToggleAppearanceManager()
{
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EDA_3D_VIEWER_SETTINGS* cfg = mgr.GetAppSettings<EDA_3D_VIEWER_SETTINGS>();
EDA_3D_VIEWER_SETTINGS* cfg = mgr.GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" );
wxAuiPaneInfo& layersManager = m_auimgr.GetPane( "LayersManager" );
// show auxiliary Vertical layers and visibility manager toolbar
+20 -1
View File
@@ -44,6 +44,8 @@
#include <eda_3d_viewer_settings.h>
#include <board_design_settings.h>
#include <3d_navlib/nl_footprint_properties_plugin.h>
PANEL_PREVIEW_3D_MODEL::PANEL_PREVIEW_3D_MODEL( wxWindow* aParent, PCB_BASE_FRAME* aFrame,
FOOTPRINT* aFootprint,
std::vector<FP_3DMODEL>* aParentModelList ) :
@@ -125,6 +127,9 @@ PANEL_PREVIEW_3D_MODEL::PANEL_PREVIEW_3D_MODEL( wxWindow* aParent, PCB_BASE_FRAM
OGL_ATT_LIST::GetAttributesList( ANTIALIASING_MODE::AA_8X ),
m_boardAdapter, m_currentCamera, PROJECT_PCB::Get3DCacheManager( &aFrame->Prj() ) );
m_spaceMouse = new NL_FOOTPRINT_PROPERTIES_PLUGIN( m_previewPane );
m_spaceMouse->SetFocus( true );
m_boardAdapter.SetBoard( m_dummyBoard );
m_boardAdapter.m_IsBoardView = false;
m_boardAdapter.m_IsPreviewer = true; // Force display 3D models, regardless the 3D viewer options
@@ -162,6 +167,8 @@ PANEL_PREVIEW_3D_MODEL::PANEL_PREVIEW_3D_MODEL( wxWindow* aParent, PCB_BASE_FRAM
wxCommandEventHandler( PANEL_PREVIEW_3D_MODEL::onUnitsChanged ),
nullptr, this );
Bind( wxCUSTOM_PANEL_SHOWN_EVENT, &PANEL_PREVIEW_3D_MODEL::onPanelShownEvent, this );
#ifdef __WXOSX__
// Call layout once to get the proper button sizes after the bitmaps have been set
Layout();
@@ -190,6 +197,7 @@ PANEL_PREVIEW_3D_MODEL::~PANEL_PREVIEW_3D_MODEL()
if( m_boardAdapter.m_Cfg )
m_boardAdapter.m_Cfg->m_Render = m_initialRender;
delete m_spaceMouse;
delete m_dummyBoard;
delete m_previewPane;
}
@@ -213,7 +221,7 @@ void PANEL_PREVIEW_3D_MODEL::loadSettings()
// TODO(JE) use all control options
m_boardAdapter.m_MousewheelPanning = settings->m_Input.scroll_modifier_zoom != 0;
EDA_3D_VIEWER_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<EDA_3D_VIEWER_SETTINGS>();
auto* cfg = Pgm().GetSettingsManager().GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" );
if( cfg )
{
@@ -620,6 +628,17 @@ void PANEL_PREVIEW_3D_MODEL::onUnitsChanged( wxCommandEvent& aEvent )
}
void PANEL_PREVIEW_3D_MODEL::onPanelShownEvent( wxCommandEvent& aEvent )
{
if( m_spaceMouse != nullptr )
{
m_spaceMouse->SetFocus( static_cast<bool>( aEvent.GetInt() ) );
}
aEvent.Skip();
}
void PANEL_PREVIEW_3D_MODEL::UpdateDummyFootprint( bool aReloadRequired )
{
m_dummyFootprint->Models().clear();
@@ -34,6 +34,7 @@
#include <3d_canvas/eda_3d_canvas.h>
#include <3d_viewer_id.h>
#include <3d_rendering/track_ball.h>
#include <wx/event.h>
// Define min and max parameter values
#define MAX_SCALE 10000.0
@@ -52,6 +53,7 @@
#define OFFSET_INCREMENT_MIL 25.0
#define OFFSET_INCREMENT_MIL_FINE 5.0
wxDECLARE_EVENT( wxCUSTOM_PANEL_SHOWN_EVENT, wxCommandEvent );
// Declared classes to create pointers
class WX_INFOBAR;
@@ -60,6 +62,7 @@ class FILENAME_RESOLVER;
class BOARD;
class BOARD_ADAPTER;
class FOOTPRINT;
class NL_FOOTPRINT_PROPERTIES_PLUGIN;
class PANEL_PREVIEW_3D_MODEL: public EDA_3D_BOARD_HOLDER, public TOOLS_HOLDER, public PANEL_PREVIEW_3D_MODEL_BASE
{
@@ -139,6 +142,7 @@ private:
void doIncrementOffset( wxSpinEvent& aEvent, double aSign );
void onUnitsChanged( wxCommandEvent& aEvent );
void onPanelShownEvent( wxCommandEvent& aEvent );
wxString formatScaleValue( double aValue );
wxString formatRotationValue( double aValue );
@@ -211,6 +215,8 @@ private:
bool m_bodyStyleShowAll; /// true if the board body is show
/// The 3d viewer Render initial settings (must be saved and restored)
EDA_3D_VIEWER_SETTINGS::RENDER_SETTINGS m_initialRender;
NL_FOOTPRINT_PROPERTIES_PLUGIN* m_spaceMouse;
};
#endif // PANEL_PREVIEW_3D_MODEL_H
+1 -1
View File
@@ -37,7 +37,7 @@
# KiCad.
#
# Note: This version string should follow the semantic versioning system
set( KICAD_SEMANTIC_VERSION "8.0.6" )
set( KICAD_SEMANTIC_VERSION "8.0.8" )
# Default the version to the semantic version.
# This is overridden by the git repository tag though (if using git)
+7
View File
@@ -109,6 +109,7 @@ static const wxChar OcePluginAngularDeflection[] = wxT( "OcePluginAngularDeflect
static const wxChar TriangulateSimplificationLevel[] = wxT( "TriangulateSimplificationLevel" );
static const wxChar TriangulateMinimumArea[] = wxT( "TriangulateMinimumArea" );
static const wxChar EnableCacheFriendlyFracture[] = wxT( "EnableCacheFriendlyFracture" );
static const wxChar MinParallelAngle[] = wxT( "MinParallelAngle" );
} // namespace KEYS
@@ -261,6 +262,8 @@ ADVANCED_CFG::ADVANCED_CFG()
m_EnableCacheFriendlyFracture = true;
m_MinParallelAngle = 0.001;
loadFromConfigFile();
}
@@ -477,6 +480,10 @@ void ADVANCED_CFG::loadSettings( wxConfigBase& aCfg )
&m_EnableCacheFriendlyFracture,
m_EnableCacheFriendlyFracture ) );
configParams.push_back( new PARAM_CFG_DOUBLE( true, AC_KEYS::MinParallelAngle,
&m_MinParallelAngle, m_MinParallelAngle,
0.0, 45.0 ) );
// Special case for trace mask setting...we just grab them and set them immediately
// Because we even use wxLogTrace inside of advanced config
wxString traceMasks;
+3
View File
@@ -162,6 +162,9 @@ void COMMIT::makeEntry( EDA_ITEM* aItem, CHANGE_TYPE aType, EDA_ITEM* aCopy, BAS
ent.m_copy = aCopy;
ent.m_screen = aScreen;
// N.B. Do not throw an assertion for multiple changed items. An item can be changed multiple times
// in a single commit such as when importing graphics and grouping them.
m_changedItems.insert( aItem );
m_changes.push_back( ent );
}
+3 -10
View File
@@ -3,7 +3,7 @@
*
* Copyright (C) 2014-2020 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2023, 2024 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -347,18 +347,11 @@ const wxString ExpandEnvVarSubstitutions( const wxString& aString, const PROJECT
}
const wxString ResolveUriByEnvVars( const wxString& aUri, PROJECT* aProject )
const wxString ResolveUriByEnvVars( const wxString& aUri, const PROJECT* aProject )
{
wxString uri = ExpandTextVars( aUri, aProject );
// URL-like URI: return as is.
wxURL url( uri );
if( url.GetError() == wxURL_NOERR )
return uri;
// Otherwise, the path points to a local file. Resolve environment variables if any.
return ExpandEnvVarSubstitutions( aUri, aProject );
return ExpandEnvVarSubstitutions( uri, aProject );
}
+9 -2
View File
@@ -18,6 +18,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <boost/algorithm/string.hpp>
#include <boost/locale.hpp>
#include <fmt/core.h>
#include <nanodbc/nanodbc.h>
@@ -236,7 +237,7 @@ bool DATABASE_CONNECTION::CacheTableInfo( const std::string& aTable,
{
std::string columnKey = toUTF8( columns.column_name() );
if( aColumns.count( columnKey ) )
if( aColumns.count( boost::to_lower_copy( columnKey ) ) )
m_columnCache[key][columnKey] = columns.data_type();
}
@@ -627,7 +628,13 @@ bool DATABASE_CONNECTION::selectAllAndCache( const std::string& aTable, const st
}
}
wxASSERT( result.count( aKey ) );
if( !result.count( aKey ) )
{
wxLogTrace( traceDatabase,
wxT( "selectAllAndCache: warning: key %s not found in result set" ), aKey );
continue;
}
std::string keyStr = std::any_cast<std::string>( result.at( aKey ) );
cacheEntry[keyStr] = result;
}
+17 -2
View File
@@ -3,7 +3,7 @@
*
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2023 CERN
* Copyright (C) 2012-2023 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2012-2023, 2024 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -465,6 +465,19 @@ void DIALOG_SHIM::OnModify()
}
int DIALOG_SHIM::ShowModal()
{
// Apple in its infinite wisdom will raise a disabled window before even passing
// us the event, so we have no way to stop it. Instead, we must set an order on
// the windows so that the modal will be pushed in front of the disabled
// window when it is raised.
KIPLATFORM::UI::ReparentModal( this );
// Call the base class ShowModal() method
return wxDialog::ShowModal();
}
/*
Quasi-Modal Mode Explained:
@@ -520,7 +533,7 @@ int DIALOG_SHIM::ShowQuasiModal()
// us the event, so we have no way to stop it. Instead, we must set an order on
// the windows so that the quasi-modal will be pushed in front of the disabled
// window when it is raised.
KIPLATFORM::UI::ReparentQuasiModal( this );
KIPLATFORM::UI::ReparentModal( this );
Show( true );
@@ -557,6 +570,8 @@ void DIALOG_SHIM::EndQuasiModal( int retCode )
return;
}
TearDownQuasiModal();
if( m_qmodal_loop )
{
if( m_qmodal_loop->IsRunning() )
+33 -8
View File
@@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2018-2022 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2018-2024 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@@ -28,6 +28,7 @@
#include <wx/dcmemory.h>
#define ALPHA_MAX 100 // the max value returned by the alpha (opacity) slider
#define SLOPE_AXIS ( bmsize.y / 5.28 ) // was 50 at 264 size
using KIGFX::COLOR4D;
@@ -52,13 +53,17 @@ DIALOG_COLOR_PICKER::DIALOG_COLOR_PICKER( wxWindow* aParent, const COLOR4D& aCur
m_allowOpacityCtrl = aAllowOpacityControl;
m_previousColor4D = aCurrentColor;
m_newColor4D = aCurrentColor;
m_cursorsSize = 8; // Size of square cursors drawn on color bitmaps
m_newColor4D.ToHSV( m_hue, m_sat, m_val, true );
m_bitmapRGB = nullptr;
m_bitmapHSV = nullptr;
m_selectedCursor = nullptr;
m_defaultColor = aDefaultColor;
updateHandleSize();
m_OldColorRect->SetMinSize( FromDIP( wxSize( 24, 24 ) ) );
m_NewColorRect->SetMinSize( FromDIP( wxSize( 24, 24 ) ) );
if( !m_allowOpacityCtrl )
{
m_SizerTransparency->Show( false );
@@ -121,16 +126,15 @@ void DIALOG_COLOR_PICKER::updatePreview( wxStaticBitmap* aStaticBitmap, COLOR4D&
wxBitmap newBm = COLOR_SWATCH::MakeBitmap( aColor4D, COLOR4D::WHITE, aStaticBitmap->GetSize(),
ConvertDialogToPixels( CHECKERBOARD_SIZE_DU ),
aStaticBitmap->GetParent()->GetBackgroundColour() );
newBm.SetScaleFactor( GetDPIScaleFactor() );
aStaticBitmap->SetBitmap( newBm );
}
bool DIALOG_COLOR_PICKER::TransferDataToWindow()
{
// Draw all bitmaps, with colors according to the color 4D
updatePreview( m_OldColorRect, m_previousColor4D );
SetEditVals( ALL_CHANGED, false );
drawAll();
// Configure the spin control sizes
configureSpinCtrl( m_spinCtrlGreen );
@@ -144,6 +148,10 @@ bool DIALOG_COLOR_PICKER::TransferDataToWindow()
finishDialogSettings();
// Draw all bitmaps, with colors according to the color 4D
updatePreview( m_OldColorRect, m_previousColor4D );
drawAll();
return true;
}
@@ -171,6 +179,8 @@ void DIALOG_COLOR_PICKER::initDefinedColors( CUSTOM_COLORS_LIST* aPredefinedColo
{
wxBitmap bm = COLOR_SWATCH::MakeBitmap( aColor, COLOR4D::WHITE, swatchSize,
checkerboardSize, checkboardBackground );
bm.SetScaleFactor( GetDPIScaleFactor() );
wxStaticBitmap* swatch = new wxStaticBitmap( m_panelDefinedColors, aId, bm );
m_fgridColor->Add( swatch, 0, wxALIGN_CENTER_VERTICAL, 5 );
@@ -245,7 +255,6 @@ void DIALOG_COLOR_PICKER::createRGBBitmap()
// Red blue area in X Z 3d axis
double inc = 255.0 / half_size;
#define SLOPE_AXIS 50.0
double slope = SLOPE_AXIS/half_size;
color.g = 0.0;
@@ -315,6 +324,7 @@ void DIALOG_COLOR_PICKER::createRGBBitmap()
delete m_bitmapRGB;
m_bitmapRGB = new wxBitmap( img, 24 );
m_bitmapRGB->SetScaleFactor( m_RgbBitmap->GetDPIScaleFactor() );
m_RgbBitmap->SetBitmap( *m_bitmapRGB );
}
@@ -379,6 +389,7 @@ void DIALOG_COLOR_PICKER::createHSVBitmap()
delete m_bitmapHSV;
m_bitmapHSV = new wxBitmap( img, 24 );
m_bitmapHSV->SetScaleFactor( m_HsvBitmap->GetDPIScaleFactor() );
m_HsvBitmap->SetBitmap( *m_bitmapHSV );
}
@@ -413,8 +424,7 @@ void DIALOG_COLOR_PICKER::drawRGBPalette()
bitmapDC.SetBrush( brush );
int half_csize = m_cursorsSize / 2;
#define SLOPE_AXIS 50.0
double slope = SLOPE_AXIS / half_size;
double slope = SLOPE_AXIS / ( half_size );
// Red axis cursor (Z 3Daxis):
m_cursorBitmapRed.x = 0;
@@ -539,8 +549,15 @@ void DIALOG_COLOR_PICKER::SetEditVals( CHANGED_COLOR aChanged, bool aCheckTransp
}
void DIALOG_COLOR_PICKER::updateHandleSize()
{
m_cursorsSize = FromDIP( 8 ); // Size of square cursors drawn on color bitmaps
}
void DIALOG_COLOR_PICKER::drawAll()
{
updateHandleSize();
m_NewColorRect->Freeze(); // Avoid flicker
m_HsvBitmap->Freeze();
m_RgbBitmap->Freeze();
@@ -699,6 +716,14 @@ void DIALOG_COLOR_PICKER::onHSVMouseDrag( wxMouseEvent& event )
}
void DIALOG_COLOR_PICKER::onSize( wxSizeEvent& event )
{
drawAll();
event.Skip();
}
void DIALOG_COLOR_PICKER::OnColorValueText( wxCommandEvent& event )
{
if( m_newColor4D.SetFromHexString( m_colorValue->GetValue() ) )
+25 -29
View File
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
// C++ code generated with wxFormBuilder (version 4.1.0-0-g733bf3d)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@@ -33,7 +33,10 @@ DIALOG_COLOR_PICKER_BASE::DIALOG_COLOR_PICKER_BASE( wxWindow* parent, wxWindowID
m_RgbBitmap = new wxStaticBitmap( sbSizerViewRGB->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 264,264 ), 0 );
m_RgbBitmap->SetMinSize( wxSize( 264,264 ) );
sbSizerViewRGB->Add( m_RgbBitmap, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
sbSizerViewRGB->Add( m_RgbBitmap, 0, wxALIGN_CENTER_HORIZONTAL|wxALL|wxEXPAND|wxSHAPED, 5 );
sbSizerViewRGB->Add( 0, 0, 1, wxEXPAND, 5 );
wxFlexGridSizer* fgSizerRGB;
fgSizerRGB = new wxFlexGridSizer( 0, 3, 0, 0 );
@@ -68,18 +71,18 @@ DIALOG_COLOR_PICKER_BASE::DIALOG_COLOR_PICKER_BASE( wxWindow* parent, wxWindowID
sbSizerViewRGB->Add( fgSizerRGB, 0, wxEXPAND, 5 );
bSizerPanels->Add( sbSizerViewRGB, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bSizerPanels->Add( sbSizerViewRGB, 1, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
wxStaticBoxSizer* sbSizerViewHSV;
sbSizerViewHSV = new wxStaticBoxSizer( new wxStaticBox( m_panelFreeColors, wxID_ANY, _("HSV") ), wxHORIZONTAL );
wxBoxSizer* bSizer10;
bSizer10 = new wxBoxSizer( wxVERTICAL );
sbSizerViewHSV = new wxStaticBoxSizer( new wxStaticBox( m_panelFreeColors, wxID_ANY, _("HSV") ), wxVERTICAL );
m_HsvBitmap = new wxStaticBitmap( sbSizerViewHSV->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 264,264 ), 0 );
m_HsvBitmap->SetMinSize( wxSize( 264,264 ) );
bSizer10->Add( m_HsvBitmap, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
sbSizerViewHSV->Add( m_HsvBitmap, 0, wxALIGN_CENTER_HORIZONTAL|wxALL|wxEXPAND|wxSHAPED, 5 );
sbSizerViewHSV->Add( 0, 0, 1, wxEXPAND, 5 );
wxFlexGridSizer* fgSizerHSV;
fgSizerHSV = new wxFlexGridSizer( 0, 2, 0, 0 );
@@ -103,26 +106,23 @@ DIALOG_COLOR_PICKER_BASE::DIALOG_COLOR_PICKER_BASE( wxWindow* parent, wxWindowID
fgSizerHSV->Add( m_spinCtrlSaturation, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bSizer10->Add( fgSizerHSV, 0, wxEXPAND, 5 );
sbSizerViewHSV->Add( fgSizerHSV, 0, wxEXPAND, 5 );
sbSizerViewHSV->Add( bSizer10, 0, wxEXPAND, 5 );
bSizerPanels->Add( sbSizerViewHSV, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
wxBoxSizer* bSizerBright;
bSizerBright = new wxBoxSizer( wxVERTICAL );
m_staticTextBright = new wxStaticText( sbSizerViewHSV->GetStaticBox(), wxID_ANY, _("Value:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextBright = new wxStaticText( m_panelFreeColors, wxID_ANY, _("Value:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextBright->Wrap( -1 );
bSizerBright->Add( m_staticTextBright, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
m_sliderBrightness = new wxSlider( sbSizerViewHSV->GetStaticBox(), wxID_ANY, 255, 0, 255, wxDefaultPosition, wxDefaultSize, wxSL_INVERSE|wxSL_LABELS|wxSL_LEFT|wxSL_VERTICAL );
m_sliderBrightness = new wxSlider( m_panelFreeColors, wxID_ANY, 255, 0, 255, wxDefaultPosition, wxDefaultSize, wxSL_INVERSE|wxSL_LABELS|wxSL_LEFT|wxSL_VERTICAL );
bSizerBright->Add( m_sliderBrightness, 1, wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxTOP, 5 );
sbSizerViewHSV->Add( bSizerBright, 0, wxEXPAND, 5 );
bSizerPanels->Add( sbSizerViewHSV, 0, wxEXPAND|wxBOTTOM|wxRIGHT, 5 );
bSizerPanels->Add( bSizerBright, 0, wxALL|wxEXPAND, 5 );
bSizerUpperFreeColors->Add( bSizerPanels, 1, wxEXPAND, 5 );
@@ -153,7 +153,7 @@ DIALOG_COLOR_PICKER_BASE::DIALOG_COLOR_PICKER_BASE( wxWindow* parent, wxWindowID
m_SizerDefinedColors->Fit( m_panelDefinedColors );
m_notebook->AddPage( m_panelDefinedColors, _("Defined Colors"), false );
bSizerUpperMain->Add( m_notebook, 0, wxEXPAND | wxALL, 5 );
bSizerUpperMain->Add( m_notebook, 1, wxEXPAND | wxALL, 5 );
m_SizerTransparency = new wxBoxSizer( wxVERTICAL );
@@ -171,35 +171,29 @@ DIALOG_COLOR_PICKER_BASE::DIALOG_COLOR_PICKER_BASE( wxWindow* parent, wxWindowID
bSizerUpperMain->Add( m_SizerTransparency, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
bSizerUpperMain->Add( 0, 0, 1, wxEXPAND|wxRIGHT|wxLEFT, 5 );
bSizerMain->Add( bSizerUpperMain, 0, wxEXPAND, 5 );
bSizerMain->Add( bSizerUpperMain, 1, wxEXPAND, 5 );
wxBoxSizer* bButtonsSizer;
bButtonsSizer = new wxBoxSizer( wxHORIZONTAL );
m_staticTextOldColor = new wxStaticText( this, wxID_ANY, _("Preview (old/new):"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextOldColor->Wrap( -1 );
bButtonsSizer->Add( m_staticTextOldColor, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
bButtonsSizer->Add( m_staticTextOldColor, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5 );
m_OldColorRect = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), 0 );
m_OldColorRect->SetMinSize( wxSize( 24,24 ) );
bButtonsSizer->Add( m_OldColorRect, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
bButtonsSizer->Add( m_OldColorRect, 0, wxALIGN_CENTER_VERTICAL|wxSHAPED, 5 );
m_NewColorRect = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), 0 );
m_NewColorRect->SetMinSize( wxSize( 24,24 ) );
bButtonsSizer->Add( m_NewColorRect, 0, wxALIGN_CENTER_VERTICAL, 5 );
bButtonsSizer->Add( 10, 0, 0, wxEXPAND, 5 );
bButtonsSizer->Add( m_NewColorRect, 0, wxALIGN_CENTER_VERTICAL|wxSHAPED, 5 );
m_colorValue = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_colorValue->SetMinSize( wxSize( 176,-1 ) );
bButtonsSizer->Add( m_colorValue, 0, wxALIGN_CENTER_VERTICAL, 5 );
bButtonsSizer->Add( m_colorValue, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
bButtonsSizer->Add( 20, 0, 0, wxEXPAND, 5 );
@@ -217,7 +211,7 @@ DIALOG_COLOR_PICKER_BASE::DIALOG_COLOR_PICKER_BASE( wxWindow* parent, wxWindowID
bButtonsSizer->Add( m_sdbSizer, 1, wxALL, 5 );
bSizerMain->Add( bButtonsSizer, 1, wxEXPAND|wxLEFT, 10 );
bSizerMain->Add( bButtonsSizer, 0, wxEXPAND|wxLEFT, 10 );
this->SetSizer( bSizerMain );
@@ -234,6 +228,7 @@ DIALOG_COLOR_PICKER_BASE::DIALOG_COLOR_PICKER_BASE( wxWindow* parent, wxWindowID
m_spinCtrlBlue->Connect( wxEVT_COMMAND_SPINCTRL_UPDATED, wxSpinEventHandler( DIALOG_COLOR_PICKER_BASE::OnChangeEditBlue ), NULL, this );
m_HsvBitmap->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_COLOR_PICKER_BASE::onHSVMouseClick ), NULL, this );
m_HsvBitmap->Connect( wxEVT_MOTION, wxMouseEventHandler( DIALOG_COLOR_PICKER_BASE::onHSVMouseDrag ), NULL, this );
m_HsvBitmap->Connect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_COLOR_PICKER_BASE::onSize ), NULL, this );
m_spinCtrlHue->Connect( wxEVT_COMMAND_SPINCTRL_UPDATED, wxSpinEventHandler( DIALOG_COLOR_PICKER_BASE::OnChangeEditHue ), NULL, this );
m_spinCtrlSaturation->Connect( wxEVT_COMMAND_SPINCTRL_UPDATED, wxSpinEventHandler( DIALOG_COLOR_PICKER_BASE::OnChangeEditSat ), NULL, this );
m_sliderBrightness->Connect( wxEVT_SCROLL_TOP, wxScrollEventHandler( DIALOG_COLOR_PICKER_BASE::OnChangeBrightness ), NULL, this );
@@ -268,6 +263,7 @@ DIALOG_COLOR_PICKER_BASE::~DIALOG_COLOR_PICKER_BASE()
m_spinCtrlBlue->Disconnect( wxEVT_COMMAND_SPINCTRL_UPDATED, wxSpinEventHandler( DIALOG_COLOR_PICKER_BASE::OnChangeEditBlue ), NULL, this );
m_HsvBitmap->Disconnect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_COLOR_PICKER_BASE::onHSVMouseClick ), NULL, this );
m_HsvBitmap->Disconnect( wxEVT_MOTION, wxMouseEventHandler( DIALOG_COLOR_PICKER_BASE::onHSVMouseDrag ), NULL, this );
m_HsvBitmap->Disconnect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_COLOR_PICKER_BASE::onSize ), NULL, this );
m_spinCtrlHue->Disconnect( wxEVT_COMMAND_SPINCTRL_UPDATED, wxSpinEventHandler( DIALOG_COLOR_PICKER_BASE::OnChangeEditHue ), NULL, this );
m_spinCtrlSaturation->Disconnect( wxEVT_COMMAND_SPINCTRL_UPDATED, wxSpinEventHandler( DIALOG_COLOR_PICKER_BASE::OnChangeEditSat ), NULL, this );
m_sliderBrightness->Disconnect( wxEVT_SCROLL_TOP, wxScrollEventHandler( DIALOG_COLOR_PICKER_BASE::OnChangeBrightness ), NULL, this );
File diff suppressed because it is too large Load Diff
+2 -1
View File
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
// C++ code generated with wxFormBuilder (version 4.1.0-0-g733bf3d)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@@ -81,6 +81,7 @@ class DIALOG_COLOR_PICKER_BASE : public DIALOG_SHIM
virtual void OnChangeEditBlue( wxSpinEvent& event ) { event.Skip(); }
virtual void onHSVMouseClick( wxMouseEvent& event ) { event.Skip(); }
virtual void onHSVMouseDrag( wxMouseEvent& event ) { event.Skip(); }
virtual void onSize( wxSizeEvent& event ) { event.Skip(); }
virtual void OnChangeEditHue( wxSpinEvent& event ) { event.Skip(); }
virtual void OnChangeEditSat( wxSpinEvent& event ) { event.Skip(); }
virtual void OnChangeBrightness( wxScrollEvent& event ) { event.Skip(); }
+3 -2
View File
@@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2020 Jon Evans <jon@craftyjon.com>
* Copyright (C) 2020-2022 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2020-2022, 2024 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@@ -39,7 +39,8 @@ DIALOG_MIGRATE_SETTINGS::DIALOG_MIGRATE_SETTINGS( SETTINGS_MANAGER* aManager ) :
SetupStandardButtons();
GetSizer()->SetSizeHints( this );
Layout();
m_sizer->Fit( this );
Centre();
}
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf)
// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
+45 -43
View File
@@ -1,34 +1,36 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<wxFormBuilder_Project>
<FileVersion major="1" minor="17"/>
<FileVersion major="1" minor="18"/>
<object class="Project" expanded="true">
<property name="class_decoration">; </property>
<property name="code_generation">C++</property>
<property name="disconnect_events">1</property>
<property name="disconnect_mode">source_name</property>
<property name="disconnect_php_events">0</property>
<property name="disconnect_python_events">0</property>
<property name="cpp_class_decoration">; </property>
<property name="cpp_disconnect_events">1</property>
<property name="cpp_event_generation">connect</property>
<property name="cpp_help_provider">none</property>
<property name="cpp_namespace"></property>
<property name="cpp_precompiled_header"></property>
<property name="cpp_use_array_enum">0</property>
<property name="cpp_use_enum">0</property>
<property name="embedded_files_path">res</property>
<property name="encoding">UTF-8</property>
<property name="event_generation">connect</property>
<property name="file">dialog_migrate_settings_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="lua_skip_events">1</property>
<property name="lua_ui_table">UI</property>
<property name="name">DIALOG_MIGRATE_SETTINGS</property>
<property name="namespace"></property>
<property name="path">.</property>
<property name="precompiled_header"></property>
<property name="php_disconnect_events">0</property>
<property name="php_disconnect_mode">source_name</property>
<property name="php_skip_events">1</property>
<property name="python_disconnect_events">0</property>
<property name="python_disconnect_mode">source_name</property>
<property name="python_image_path_wrapper_function_name"></property>
<property name="python_indent_with_spaces"></property>
<property name="python_skip_events">1</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>
<property name="use_native_eol">0</property>
<object class="Dialog" expanded="true">
<property name="aui_managed">0</property>
<property name="aui_manager_style">wxAUI_MGR_DEFAULT</property>
@@ -49,7 +51,7 @@
<property name="name">DIALOG_MIGRATE_SETTINGS_BASE</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style">wxCAPTION</property>
<property name="style">wxCAPTION|wxRESIZE_BORDER</property>
<property name="subclass">DIALOG_SHIM; dialog_shim.h; forward_declare</property>
<property name="title">Configure KiCad Settings Path</property>
<property name="tooltip"></property>
@@ -80,10 +82,10 @@
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_layer">0</property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="aui_position">0</property>
<property name="aui_row">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
@@ -152,10 +154,10 @@
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_layer">0</property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="aui_position">0</property>
<property name="aui_row">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
@@ -214,10 +216,10 @@
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_layer">0</property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="aui_position">0</property>
<property name="aui_row">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
@@ -299,10 +301,10 @@
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_layer">0</property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="aui_position">0</property>
<property name="aui_row">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
@@ -368,10 +370,10 @@
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_layer">0</property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="aui_position">0</property>
<property name="aui_row">0</property>
<property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
@@ -445,10 +447,10 @@
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_layer">0</property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="aui_position">0</property>
<property name="aui_row">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
@@ -507,10 +509,10 @@
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_layer">0</property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="aui_position">0</property>
<property name="aui_row">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
@@ -572,10 +574,10 @@
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_layer">0</property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="aui_position">0</property>
<property name="aui_row">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf)
// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@@ -32,7 +32,6 @@ class STD_BITMAP_BUTTON;
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_MIGRATE_SETTINGS_BASE
///////////////////////////////////////////////////////////////////////////////
@@ -64,7 +63,7 @@ class DIALOG_MIGRATE_SETTINGS_BASE : public DIALOG_SHIM
public:
DIALOG_MIGRATE_SETTINGS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Configure KiCad Settings Path"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxCAPTION );
DIALOG_MIGRATE_SETTINGS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Configure KiCad Settings Path"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxCAPTION|wxRESIZE_BORDER );
~DIALOG_MIGRATE_SETTINGS_BASE();
+5 -2
View File
@@ -34,7 +34,8 @@
#include <wx/fdrepdlg.h>
#include <eda_pattern_match.h>
EDA_ITEM::EDA_ITEM( EDA_ITEM* parent, KICAD_T idType ) :
EDA_ITEM::EDA_ITEM( EDA_ITEM* parent, KICAD_T idType, bool isSCH_ITEM, bool isBOARD_ITEM ) :
KIGFX::VIEW_ITEM( isSCH_ITEM, isBOARD_ITEM ),
m_parent( parent ),
m_forceVisible( false ),
m_flags( 0 ),
@@ -42,7 +43,8 @@ EDA_ITEM::EDA_ITEM( EDA_ITEM* parent, KICAD_T idType ) :
{ }
EDA_ITEM::EDA_ITEM( KICAD_T idType ) :
EDA_ITEM::EDA_ITEM( KICAD_T idType, bool isSCH_ITEM, bool isBOARD_ITEM ) :
KIGFX::VIEW_ITEM( isSCH_ITEM, isBOARD_ITEM ),
m_parent( nullptr ),
m_forceVisible( false ),
m_flags( 0 ),
@@ -51,6 +53,7 @@ EDA_ITEM::EDA_ITEM( KICAD_T idType ) :
EDA_ITEM::EDA_ITEM( const EDA_ITEM& base ) :
KIGFX::VIEW_ITEM( base.IsSCH_ITEM(), base.IsBOARD_ITEM() ),
m_Uuid( base.m_Uuid ),
m_parent( base.m_parent ),
m_forceVisible( base.m_forceVisible ),
+6
View File
@@ -476,6 +476,12 @@ int EDA_COMBINED_MATCHER::ScoreTerms( std::vector<SEARCH_TERM>& aWeightedTerms )
if( !term.Normalized )
{
term.Text = term.Text.MakeLower().Trim( false ).Trim( true );
// Don't cause KiCad to hang if someone accidentally pastes the PCB or schematic
// into the search box.
if( term.Text.Length() > 5000 )
term.Text = term.Text.Left( 5000 );
term.Normalized = true;
}
+58 -3
View File
@@ -182,6 +182,32 @@ void EDA_SHAPE::SetLength( const double& aLength )
}
}
void EDA_SHAPE::SetRectangleHeight( const int& aHeight )
{
switch ( m_shape )
{
case SHAPE_T::RECTANGLE:
m_rectangleHeight = aHeight;
SetEndY( GetStartY() + m_rectangleHeight );
break;
default: UNIMPLEMENTED_FOR( SHAPE_T_asString() );
}
}
void EDA_SHAPE::SetRectangleWidth( const int& aWidth )
{
switch ( m_shape )
{
case SHAPE_T::RECTANGLE:
m_rectangleWidth = aWidth;
SetEndX( GetStartX() + m_rectangleWidth );
break;
default: UNIMPLEMENTED_FOR( SHAPE_T_asString() );
}
}
void EDA_SHAPE::SetRectangle( const long long int& aHeight, const long long int& aWidth )
{
switch ( m_shape )
@@ -1971,6 +1997,15 @@ static struct EDA_SHAPE_DESC
return false;
};
auto isRectangle = []( 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::RECTANGLE;
return false;
};
const wxString shapeProps = _HKI( "Shape Properties" );
auto shape = new PROPERTY_ENUM<EDA_SHAPE, SHAPE_T>( _HKI( "Shape" ),
@@ -2018,6 +2053,18 @@ static struct EDA_SHAPE_DESC
shapeProps )
.SetAvailableFunc( isNotPolygonOrCircle );
propMgr.AddProperty( new PROPERTY<EDA_SHAPE, int>( _HKI( "Width" ),
&EDA_SHAPE::SetRectangleWidth, &EDA_SHAPE::GetRectangleWidth, PROPERTY_DISPLAY::PT_COORD,
ORIGIN_TRANSFORMS::ABS_Y_COORD ),
shapeProps )
.SetAvailableFunc( isRectangle );
propMgr.AddProperty( new PROPERTY<EDA_SHAPE, int>( _HKI( "Height" ),
&EDA_SHAPE::SetRectangleHeight, &EDA_SHAPE::GetRectangleHeight, PROPERTY_DISPLAY::PT_COORD,
ORIGIN_TRANSFORMS::ABS_Y_COORD ),
shapeProps )
.SetAvailableFunc( isRectangle );
propMgr.AddProperty( new PROPERTY<EDA_SHAPE, int>( _HKI( "Line Width" ),
&EDA_SHAPE::SetWidth, &EDA_SHAPE::GetWidth, PROPERTY_DISPLAY::PT_SIZE ),
shapeProps );
@@ -2070,9 +2117,17 @@ static struct EDA_SHAPE_DESC
shapeProps )
.SetAvailableFunc( fillAvailable );
propMgr.AddProperty( new PROPERTY<EDA_SHAPE, COLOR4D>( _HKI( "Fill Color" ),
&EDA_SHAPE::SetFillColor, &EDA_SHAPE::GetFillColor ),
shapeProps )
auto fillColor = new PROPERTY<EDA_SHAPE, COLOR4D>( _HKI( "Fill Color" ),
&EDA_SHAPE::SetFillColor, &EDA_SHAPE::GetFillColor );
fillColor->SetWriteableFunc(
[=]( INSPECTABLE* aItem ) -> bool
{
if( EDA_SHAPE* edaShape = dynamic_cast<EDA_SHAPE*>( aItem ) )
return edaShape->GetFillMode() == FILL_T::FILLED_WITH_COLOR;
return true;
} );
propMgr.AddProperty( fillColor, shapeProps )
.SetAvailableFunc( fillAvailable )
.SetIsHiddenFromRulesEditor();
}
+50 -4
View File
@@ -212,6 +212,26 @@ void EDA_TEXT::SetTextAngle( const EDA_ANGLE& aAngle )
void EDA_TEXT::SetItalic( bool aItalic )
{
if( m_attributes.m_Italic != aItalic )
{
const KIFONT::FONT* font = GetFont();
if( !font || font->IsStroke() )
{
// For stroke fonts, just need to set the attribute.
}
else
{
// For outline fonts, italic-ness is determined by the font itself.
SetFont( KIFONT::FONT::GetFont( font->GetName(), IsBold(), aItalic ) );
}
}
SetItalicFlag( aItalic );
}
void EDA_TEXT::SetItalicFlag( bool aItalic )
{
m_attributes.m_Italic = aItalic;
ClearRenderCache();
@@ -223,12 +243,38 @@ void EDA_TEXT::SetBold( bool aBold )
{
if( m_attributes.m_Bold != aBold )
{
int size = std::min( m_attributes.m_Size.x, m_attributes.m_Size.y );
const KIFONT::FONT* font = GetFont();
if( aBold )
m_attributes.m_StrokeWidth = GetPenSizeForBold( size );
if( !font || font->IsStroke() )
{
// For stroke fonts, boldness is determined by the pen size.
const int size = std::min( m_attributes.m_Size.x, m_attributes.m_Size.y );
if( aBold )
{
m_attributes.m_StoredStrokeWidth = m_attributes.m_StrokeWidth;
m_attributes.m_StrokeWidth = GetPenSizeForBold( size );
}
else
{
// Restore the original stroke width from `m_StoredStrokeWidth` if it was previously stored,
// resetting the width after unbolding.
if( m_attributes.m_StoredStrokeWidth )
m_attributes.m_StrokeWidth = m_attributes.m_StoredStrokeWidth;
else
{
m_attributes.m_StrokeWidth = GetPenSizeForNormal( size );
// Sets `m_StrokeWidth` to the normal pen size and stores it in `m_StoredStrokeWidth`
// as the default, but only if the bold option was applied before this feature was implemented.
m_attributes.m_StoredStrokeWidth = m_attributes.m_StrokeWidth;
}
}
}
else
m_attributes.m_StrokeWidth = GetPenSizeForNormal( size );
{
// For outline fonts, boldness is determined by the font itself.
SetFont( KIFONT::FONT::GetFont( font->GetName(), aBold, IsItalic() ) );
}
}
SetBoldFlag( aBold );
+8
View File
@@ -452,6 +452,8 @@ VECTOR2I OUTLINE_FONT::getTextAsGlyphsUnlocked( BOX2I* aBBox,
for( SHAPE_LINE_CHAIN& hole : holes )
{
bool added_hole = false;
if( hole.PointCount() )
{
for( int ii = 0; ii < glyph->OutlineCount(); ++ii )
@@ -459,9 +461,15 @@ VECTOR2I OUTLINE_FONT::getTextAsGlyphsUnlocked( BOX2I* aBBox,
if( glyph->Outline( ii ).PointInside( hole.GetPoint( 0 ) ) )
{
glyph->AddHole( std::move( hole ), ii );
added_hole = true;
break;
}
}
// Some lovely TTF fonts decided that winding didn't matter for outlines that
// don't have holes, so holes that don't fit in any outline are added as outlines
if( !added_hole )
glyph->AddOutline( std::move( hole ) );
}
}
+2 -1
View File
@@ -35,7 +35,8 @@ TEXT_ATTRIBUTES::TEXT_ATTRIBUTES( KIFONT::FONT* aFont ) :
m_Visible( true ),
m_Mirrored( false ),
m_Multiline( true ),
m_KeepUpright( false )
m_KeepUpright( false ),
m_StoredStrokeWidth( 0 )
{
}
-19
View File
@@ -275,25 +275,6 @@ bool OpenPDF( const wxString& file )
}
void OpenFile( const wxString& file )
{
wxFileName fileName( file );
wxFileType* filetype = wxTheMimeTypesManager->GetFileTypeFromExtension( fileName.GetExt() );
if( !filetype )
return;
wxString command;
wxFileType::MessageParameters params( file );
filetype->GetOpenCommand( &command, params );
delete filetype;
if( !command.IsEmpty() )
wxExecute( command );
}
void KiCopyFile( const wxString& aSrcPath, const wxString& aDestPath, wxString& aErrors )
{
if( !wxCopyFile( aSrcPath, aDestPath ) )
+16 -1
View File
@@ -693,7 +693,14 @@ void GRID_TRICKS::paste_clipboard()
wxTheClipboard->GetData( data );
paste_text( data.GetText() );
wxString text = data.GetText();
#ifdef __WXMAC__
// Some editors use windows linefeeds (\r\n), which wx re-writes to \n\n
text.Replace( "\n\n", "\n" );
#endif
paste_text( text );
}
wxTheClipboard->Close();
@@ -802,6 +809,14 @@ void GRID_TRICKS::paste_text( const wxString& cb_text )
{
tbl->SetValue( row, col, cellTxt );
wxGridEvent evt( m_grid->GetId(), wxEVT_GRID_CELL_CHANGED, m_grid, row, col );
m_grid->GetEventHandler()->ProcessEvent( evt );
}
// Allow paste to any cell that can accept a boolean value
else if( tbl->CanSetValueAs( row, col, wxGRID_VALUE_BOOL ) )
{
tbl->SetValueAsBool( row, col, cellTxt == wxT( "1" ) );
wxGridEvent evt( m_grid->GetId(), wxEVT_GRID_CELL_CHANGED, m_grid, row, col );
m_grid->GetEventHandler()->ProcessEvent( evt );
}
+12 -9
View File
@@ -98,7 +98,7 @@ DXF_IMPORT_PLUGIN::DXF_IMPORT_PLUGIN() : DL_CreationAdapter()
m_brdLayer = Dwgs_User; // The default import layer
m_importAsFPShapes = true;
m_minX = m_minY = std::numeric_limits<double>::max();
m_maxX = m_maxY = std::numeric_limits<double>::min();
m_maxX = m_maxY = std::numeric_limits<double>::lowest();
m_currentUnit = DXF_IMPORT_UNITS::DEFAULT;
m_importCoordinatePrecision = 4; // initial value per dxf spec
@@ -131,7 +131,7 @@ bool DXF_IMPORT_PLUGIN::Load( const wxString& aFileName )
m_internalImporter.ClearShapes();
reportMsg( _( "Memory was exhausted trying to load the DXF, it may be too large." ) );
ReportMsg( _( "Memory was exhausted trying to load the DXF, it may be too large." ) );
return false;
}
}
@@ -151,7 +151,7 @@ bool DXF_IMPORT_PLUGIN::LoadFromMemory( const wxMemoryBuffer& aMemBuffer )
m_internalImporter.ClearShapes();
reportMsg( _( "Memory was exhausted trying to load the DXF, it may be too large." ) );
ReportMsg( _( "Memory was exhausted trying to load the DXF, it may be too large." ) );
return false;
}
}
@@ -247,7 +247,7 @@ bool DXF_IMPORT_PLUGIN::ImportDxfFile( const wxMemoryBuffer& aMemBuffer )
}
void DXF_IMPORT_PLUGIN::reportMsg( const wxString& aMessage )
void DXF_IMPORT_PLUGIN::ReportMsg( const wxString& aMessage )
{
// Add message to keep trace of not handled dxf entities
m_messages += aMessage;
@@ -1411,8 +1411,8 @@ void DXF_IMPORT_PLUGIN::insertSpline( double aWidth )
ctrlp.push_back( m_curr_entity.m_SplineControlPointList[ii].m_y );
}
std::vector<double> coords;
tinyspline::BSpline beziers;
std::vector<double> coords;
try
{
@@ -1421,15 +1421,18 @@ void DXF_IMPORT_PLUGIN::insertSpline( double aWidth )
dxfspline.setControlPoints( ctrlp );
dxfspline.setKnots( m_curr_entity.m_SplineKnotsList );
beziers = tinyspline::BSpline( dxfspline.toBeziers() );
if( dxfspline.degree() < 3 )
dxfspline = dxfspline.elevateDegree( 3 - dxfspline.degree() );
beziers = dxfspline.toBeziers();
coords = beziers.controlPoints();
}
catch( const std::runtime_error& ) // tinyspline throws everything including data validation
// as runtime errors
{
// invalid spline definition, drop this block
reportMsg( _( "Invalid spline definition encountered" ) );
ReportMsg( _( "Invalid spline definition encountered" ) );
return;
}
@@ -1446,14 +1449,14 @@ void DXF_IMPORT_PLUGIN::insertSpline( double aWidth )
// not sure why this happens, but it seems to sometimes slip degree on the final bezier
VECTOR2D bezierControl2;
if( ii + 4 >= coords.size() )
if( ii + 5 >= coords.size() )
bezierControl2 = bezierControl1;
else
bezierControl2 = VECTOR2D( mapX( coords[ii + 4] ), mapY( coords[ii + 5] ) );
VECTOR2D end;
if( ii + 6 >= coords.size() )
if( ii + 7 >= coords.size() )
end = bezierControl2;
else
end = VECTOR2D( mapX( coords[ii + 6] ), mapY( coords[ii + 7] ) );
+18 -18
View File
@@ -320,10 +320,10 @@ public:
{
return m_messages;
}
// report message to keep trace of not supported dxf entities:
void ReportMsg( const wxString& aMessage ) override;
private:
// report message to keep trace of not supported dxf entities:
void reportMsg( const wxString& aMessage );
// coordinate conversions from dxf file to mm
double mapX( double aDxfCoordX );
@@ -455,77 +455,77 @@ private:
// Not yet handled DXF entities:
virtual void addXLine( const DL_XLineData& ) override
{
reportMsg( _( "DXF construction lines not currently supported." ) );
ReportMsg( _( "DXF construction lines not currently supported." ) );
}
virtual void addRay( const DL_RayData& ) override
{
reportMsg( _( "DXF construction lines not currently supported." ) );
ReportMsg( _( "DXF construction lines not currently supported." ) );
}
virtual void addArcAlignedText( const DL_ArcAlignedTextData& ) override
{
reportMsg( _( "DXF arc-aligned text not currently supported." ) );
ReportMsg( _( "DXF arc-aligned text not currently supported." ) );
}
virtual void addDimAlign( const DL_DimensionData&, const DL_DimAlignedData& ) override
{
reportMsg( _( "DXF dimensions not currently supported." ) );
ReportMsg( _( "DXF dimensions not currently supported." ) );
}
virtual void addDimLinear( const DL_DimensionData&, const DL_DimLinearData& ) override
{
reportMsg( _( "DXF dimensions not currently supported." ) );
ReportMsg( _( "DXF dimensions not currently supported." ) );
}
virtual void addDimRadial( const DL_DimensionData&, const DL_DimRadialData& ) override
{
reportMsg( _( "DXF dimensions not currently supported." ) );
ReportMsg( _( "DXF dimensions not currently supported." ) );
}
virtual void addDimDiametric( const DL_DimensionData&, const DL_DimDiametricData& ) override
{
reportMsg( _( "DXF dimensions not currently supported." ) );
ReportMsg( _( "DXF dimensions not currently supported." ) );
}
virtual void addDimAngular( const DL_DimensionData&, const DL_DimAngular2LData& ) override
{
reportMsg( _( "DXF dimensions not currently supported." ) );
ReportMsg( _( "DXF dimensions not currently supported." ) );
}
virtual void addDimAngular3P( const DL_DimensionData&, const DL_DimAngular3PData& ) override
{
reportMsg( _( "DXF dimensions not currently supported." ) );
ReportMsg( _( "DXF dimensions not currently supported." ) );
}
virtual void addDimOrdinate( const DL_DimensionData&, const DL_DimOrdinateData& ) override
{
reportMsg( _( "DXF dimensions not currently supported." ) );
ReportMsg( _( "DXF dimensions not currently supported." ) );
}
virtual void addLeader( const DL_LeaderData& ) override
{
reportMsg( _( "DXF dimensions not currently supported." ) );
ReportMsg( _( "DXF dimensions not currently supported." ) );
}
virtual void addLeaderVertex( const DL_LeaderVertexData& ) override { }
virtual void addHatch( const DL_HatchData& ) override
{
reportMsg( _( "DXF hatches not currently supported." ) );
ReportMsg( _( "DXF hatches not currently supported." ) );
}
virtual void addHatchLoop( const DL_HatchLoopData& ) override { }
virtual void addHatchEdge( const DL_HatchEdgeData& ) override { }
virtual void addTrace( const DL_TraceData& ) override
{
reportMsg( _( "DXF traces not currently supported." ) );
ReportMsg( _( "DXF traces not currently supported." ) );
}
virtual void add3dFace( const DL_3dFaceData& ) override
{
reportMsg( _( "DXF 3dfaces not currently supported." ) );
ReportMsg( _( "DXF 3dfaces not currently supported." ) );
}
virtual void addSolid( const DL_SolidData& ) override
{
reportMsg( _( "DXF solids not currently supported." ) );
ReportMsg( _( "DXF solids not currently supported." ) );
}
virtual void addImage( const DL_ImageData& ) override
{
reportMsg( _( "DXF images not currently supported." ) );
ReportMsg( _( "DXF images not currently supported." ) );
}
virtual void linkImage( const DL_ImageDefData& ) override {}
@@ -131,6 +131,8 @@ public:
*/
const virtual wxString& GetMessages() const = 0;
virtual void ReportMsg( const wxString& aMessage ) = 0;
protected:
///< Importer used to create objects representing the imported shapes.
GRAPHICS_IMPORTER* m_importer;
+5
View File
@@ -125,6 +125,11 @@ public:
return m_plugin->GetMessages();
}
void ReportMsg( const wxString& aMessage )
{
m_plugin->ReportMsg( aMessage );
}
/**
* Get original image Width.
*
@@ -98,6 +98,89 @@ void GRAPHICS_IMPORTER_BUFFER::AddShape( std::unique_ptr<IMPORTED_SHAPE>& aShape
void GRAPHICS_IMPORTER_BUFFER::ImportTo( GRAPHICS_IMPORTER& aImporter )
{
BOX2D boundingBox;
for( std::unique_ptr<IMPORTED_SHAPE>& shape : m_shapes )
{
BOX2D box = shape->GetBoundingBox();
if( box.IsValid() )
boundingBox.Merge( box );
}
boundingBox.SetOrigin( boundingBox.GetPosition().x * aImporter.GetScale().x,
boundingBox.GetPosition().y * aImporter.GetScale().y );
boundingBox.SetSize( boundingBox.GetSize().x * aImporter.GetScale().x,
boundingBox.GetSize().y * aImporter.GetScale().y );
// Check that the scaled graphics fit in the KiCad numeric limits
if( boundingBox.GetSize().x * aImporter.GetMillimeterToIuFactor() > std::numeric_limits<int>::max() ||
boundingBox.GetSize().y * aImporter.GetMillimeterToIuFactor() > std::numeric_limits<int>::max() )
{
double scale_factor = std::numeric_limits<int>::max() / ( aImporter.GetMillimeterToIuFactor() + 100 );
double max_scale = std::max( scale_factor / boundingBox.GetSize().x,
scale_factor / boundingBox.GetSize().y );
aImporter.ReportMsg( wxString::Format( _( "Imported graphic is too large. Maximum scale is %f" ),
max_scale ) );
return;
}
// They haven't set the import offset, so we set it to the bounding box origin to keep the graphics
// in the KiCad drawing area
else if( aImporter.GetImportOffsetMM() == VECTOR2D( 0, 0 ) )
{
VECTOR2D offset = boundingBox.GetOrigin();
aImporter.SetImportOffsetMM( -offset );
}
else
{
VECTOR2D bbox_origin = boundingBox.GetOrigin();
aImporter.SetImportOffsetMM( -bbox_origin + aImporter.GetImportOffsetMM() );
double total_scale_x = aImporter.GetScale().x * aImporter.GetMillimeterToIuFactor();
double total_scale_y = aImporter.GetScale().y * aImporter.GetMillimeterToIuFactor();
double max_offset_x =
( aImporter.GetImportOffsetMM().x + boundingBox.GetRight() ) * total_scale_x;
double max_offset_y =
( aImporter.GetImportOffsetMM().y + boundingBox.GetBottom() ) * total_scale_y;
double min_offset_x =
( aImporter.GetImportOffsetMM().x + boundingBox.GetLeft() ) * total_scale_x;
double min_offset_y =
( aImporter.GetImportOffsetMM().y + boundingBox.GetTop() ) * total_scale_y;
VECTOR2D newOffset = aImporter.GetImportOffsetMM();
bool needsAdjustment = false;
if( max_offset_x >= std::numeric_limits<int>::max() )
{
newOffset.x -= ( max_offset_x - std::numeric_limits<int>::max() + 100.0 ) / total_scale_x;
needsAdjustment = true;
}
else if( min_offset_x <= std::numeric_limits<int>::min() )
{
newOffset.x -= ( min_offset_x - std::numeric_limits<int>::min() - 100 ) / total_scale_x;
needsAdjustment = true;
}
if( max_offset_y >= std::numeric_limits<int>::max() )
{
newOffset.y -= ( max_offset_y - std::numeric_limits<int>::max() + 100 ) / total_scale_y;
needsAdjustment = true;
}
else if( min_offset_y <= std::numeric_limits<int>::min() )
{
newOffset.y -= ( min_offset_y - std::numeric_limits<int>::min() - 100 ) / total_scale_y;
needsAdjustment = true;
}
if( needsAdjustment )
{
aImporter.ReportMsg( wxString::Format( _( "Import offset adjusted to (%f, %f) to fit within numeric limits" ),
newOffset.x, newOffset.y ) );
aImporter.SetImportOffsetMM( newOffset );
}
}
for( std::unique_ptr<IMPORTED_SHAPE>& shape : m_shapes )
shape->ImportTo( aImporter );
}
@@ -30,6 +30,7 @@
#include "graphics_importer.h"
#include <math/matrix3x3.h>
#include <math/box2.h>
#include <list>
@@ -46,6 +47,8 @@ public:
void SetParentShapeIndex( int aIndex ) { m_parentShapeIndex = aIndex; }
int GetParentShapeIndex() const { return m_parentShapeIndex; }
virtual BOX2D GetBoundingBox() const = 0;
protected:
int m_parentShapeIndex = -1;
};
@@ -75,6 +78,14 @@ public:
m_end = aTransform * m_end + aTranslation;
}
BOX2D GetBoundingBox() const override
{
BOX2D box;
box.Merge( m_start );
box.Merge( m_end );
return box;
}
private:
VECTOR2D m_start;
VECTOR2D m_end;
@@ -113,6 +124,14 @@ public:
m_radius = newRadius.EuclideanNorm();
}
BOX2D GetBoundingBox() const override
{
BOX2D box;
box.Merge( m_center - VECTOR2D( m_radius, m_radius ) );
box.Merge( m_center + VECTOR2D( m_radius, m_radius ) );
return box;
}
private:
VECTOR2D m_center;
double m_radius;
@@ -148,6 +167,26 @@ public:
m_center = aTransform * m_center + aTranslation;
}
BOX2D GetBoundingBox() const override
{
BOX2D box;
box.Merge( m_start + m_stroke.GetWidth() );
box.Merge( m_start - m_stroke.GetWidth() );
for( double angle = 0; angle < m_angle.AsDegrees(); angle += 5 )
{
EDA_ANGLE ang = EDA_ANGLE( angle );
VECTOR2D start = m_center + m_start;
VECTOR2D pt = {start.x * ang.Cos() + start.y * ang.Sin(),
start.x * ang.Sin() - start.y * ang.Cos()};
box.Merge( pt );
}
return box;
}
private:
VECTOR2D m_center;
VECTOR2D m_start;
@@ -192,6 +231,16 @@ public:
const IMPORTED_STROKE& GetStroke() const { return m_stroke; }
BOX2D GetBoundingBox() const override
{
BOX2D box;
for( const VECTOR2D& vert : m_vertices )
box.Merge( vert );
return box;
}
private:
std::vector<VECTOR2D> m_vertices;
IMPORTED_STROKE m_stroke;
@@ -227,6 +276,19 @@ public:
void Transform( const MATRIX3x3D& aTransform, const VECTOR2D& aTranslation ) override
{
m_origin = aTransform * m_origin + aTranslation;
VECTOR2D textSize = aTransform * VECTOR2D( m_width, m_height );
m_width = textSize.x;
m_height = textSize.y;
}
BOX2D GetBoundingBox() const override
{
BOX2D box;
box.Merge( m_origin );
box.Merge( m_origin + VECTOR2D( m_width * m_text.length(), m_height ) );
return box;
}
private:
@@ -272,6 +334,14 @@ public:
m_end = aTransform * m_end + aTranslation;
}
BOX2D GetBoundingBox() const override
{
BOX2D box;
box.Merge( m_start );
box.Merge( m_end );
return box;
}
private:
VECTOR2D m_start;
VECTOR2D m_bezierControl1;
+8
View File
@@ -426,3 +426,11 @@ static float distanceFromPointToLine( const VECTOR2D& aPoint, const VECTOR2D& aL
return fabs( distance );
}
void SVG_IMPORT_PLUGIN::ReportMsg( const wxString& aMessage )
{
// Add message to keep trace of not handled svg entities
m_messages += aMessage;
m_messages += '\n';
}
+2
View File
@@ -62,6 +62,8 @@ public:
return m_messages;
}
void ReportMsg( const wxString& aMessage ) override;
bool Import() override;
bool Load( const wxString& aFileName ) override;
bool LoadFromMemory( const wxMemoryBuffer& aMemBuffer ) override;
+2 -1
View File
@@ -117,7 +117,8 @@ std::map<wxString, wxString> ALTIUM_ASCII_PARSER::ReadProperties()
if( canonicalKey == wxT( "DESIGNATOR" ) || canonicalKey == wxT( "NAME" )
|| canonicalKey == wxT( "TEXT" ) )
{
value = AltiumPropertyToKiCadString( value );
if( kv[ wxT( "RECORD" ) ] != wxT( "4" ) )
value = AltiumPropertyToKiCadString( value );
}
}
+2 -1
View File
@@ -493,7 +493,8 @@ std::map<wxString, wxString> ALTIUM_BINARY_PARSER::ReadProperties(
|| canonicalKey == wxT( "NAME" )
|| canonicalKey == wxT( "TEXT" ) )
{
value = AltiumPropertyToKiCadString( value.Trim() );
if( kv[ wxT( "RECORD" ) ] != wxT( "4" ) )
value = AltiumPropertyToKiCadString( value.Trim() );
}
kv.insert( { canonicalKey, value.Trim() } );
+40 -72
View File
@@ -45,40 +45,52 @@ LIB_ID AltiumToKiCadLibID( const wxString& aLibName, const wxString& aLibReferen
wxString AltiumPropertyToKiCadString( const wxString& aString )
{
wxString converted;
bool inOverbar = false;
wxString output;
wxString tempString;
bool hasPrev = false;
wxUniChar prev;
for( wxString::const_iterator chIt = aString.begin(); chIt != aString.end(); ++chIt )
for( wxString::const_iterator it = aString.begin(); it != aString.end(); ++it )
{
wxString::const_iterator lookahead = chIt + 1;
char ch = 0;
if( lookahead != aString.end() && *lookahead == '\\' )
if( (*it).GetAsChar( &ch ) )
{
if( !inOverbar )
if( ch == '\\' )
{
converted += "~{";
inOverbar = true;
if( hasPrev )
{
tempString += prev;
hasPrev = false;
}
continue; // Backslash is ignored and not added to the output
}
}
if( hasPrev ) // Two letters in a row with no backslash
{
if( !tempString.empty() )
{
output += "~{" + tempString + "}";
tempString.Clear();
}
converted += *chIt;
chIt = lookahead;
output += prev;
}
else
{
if( inOverbar )
{
converted += "}";
inOverbar = false;
}
converted += *chIt;
}
prev = *it;
hasPrev = true;
}
if( inOverbar )
converted += "}";
// Append any leftover escaped string
if( !tempString.IsEmpty() )
output += "~{" + tempString + "}";
return converted;
if( hasPrev )
output += prev;
return output;
}
@@ -148,9 +160,7 @@ wxString AltiumPcbSpecialStringsToKiCadStrings( const wxString&
const std::map<wxString, wxString>& aOverrides )
{
if( aString.IsEmpty() )
{
return aString;
}
// special case: string starts with dot -> whole string is special string
if( aString.at( 0 ) == '.' )
@@ -174,57 +184,15 @@ wxString AltiumPcbSpecialStringsToKiCadStrings( const wxString&
wxString AltiumPinNamesToKiCad( wxString& aString )
{
wxString output;
wxString tempString;
bool hasPrev = false;
wxUniChar prev;
if( aString.IsEmpty() )
return wxEmptyString;
wxString rest;
for( wxString::const_iterator it = aString.begin(); it != aString.end(); ++it )
{
char ch = 0;
if( aString.StartsWith( '\\', &rest ) && !rest.Contains( '\\' ) )
return "~{" + rest + "}";
if( (*it).GetAsChar( &ch ) )
{
if( ch == '\\' )
{
if( hasPrev )
{
tempString += prev;
hasPrev = false;
}
continue; // Backslash is ignored and not added to the output
}
}
if( hasPrev ) // Two letters in a row with no backslash
{
if( !tempString.empty() )
{
output += "~{" + tempString + "}";
tempString.Clear();
}
output += prev;
}
prev = *it;
hasPrev = true;
}
// Append any leftover escaped string
if( !tempString.IsEmpty() )
{
output += "~{" + tempString + "}";
}
if( hasPrev )
{
output += prev;
}
return output;
return AltiumPropertyToKiCadString( aString );
}
VECTOR2I AltiumGetEllipticalPos( double aMajor, double aMinor, double aAngleRadians )
+3 -3
View File
@@ -815,11 +815,11 @@ EPAD::EPAD( wxXmlNode* aPad )
>
*/
// #REQUIRED says DTD, throw exception if not found
drill = parseRequiredAttribute<ECOORD>( aPad, "drill" );
// #REQUIRED says DTD, but DipTrace doesn't write it sometimes
drill = parseOptionalAttribute<ECOORD>( aPad, "drill" );
// Optional attributes
diameter = parseOptionalAttribute<ECOORD>( aPad, "diameter" );
diameter = parseOptionalAttribute<ECOORD>( aPad, "diameter" );
opt_wxString s = parseOptionalAttribute<wxString>( aPad, "shape" );
+1 -1
View File
@@ -711,7 +711,7 @@ struct EPAD_COMMON
/// Eagle thru hole pad
struct EPAD : public EPAD_COMMON
{
ECOORD drill;
opt_ecoord drill;
opt_ecoord diameter;
// for shape: (square | round | octagon | long | offset)
@@ -307,3 +307,20 @@ EASYEDAPRO::ParseJsonLinesWithSeparation( wxInputStream& aInput, const wxString&
return lineBlocks;
}
std::map<wxString, wxString>
EASYEDAPRO::AnyMapToStringMap( const std::map<wxString, nlohmann::json>& aInput )
{
std::map<wxString, wxString> stringMap;
for( auto& [key, value] : aInput )
{
if( value.is_string() )
stringMap[key] = value.get<wxString>();
else if( value.is_number() )
stringMap[key] = wxString::FromCDouble( value.get<double>() );
}
return stringMap;
}
@@ -63,6 +63,8 @@ std::vector<nlohmann::json> ParseJsonLines( wxInputStream& aInput, const wxStrin
std::vector<std::vector<nlohmann::json>> ParseJsonLinesWithSeparation( wxInputStream& aInput,
const wxString& aSource );
std::map<wxString, wxString> AnyMapToStringMap( const std::map<wxString, nlohmann::json>& aInput );
} // namespace EASYEDAPRO
+2 -1
View File
@@ -29,6 +29,7 @@
#include <nlohmann/json.hpp>
#include <core/json_serializers.h>
#include <string_utils.h>
#include <io/easyedapro/easyedapro_import_utils.h>
void EASYEDAPRO::from_json( const nlohmann::json& j, EASYEDAPRO::SCH_ATTR& d )
@@ -273,7 +274,7 @@ void EASYEDAPRO::from_json( const nlohmann::json& j, EASYEDAPRO::PRJ_DEVICE& d )
d.custom_tags = j.at( "custom_tags" );
if( j.at( "attributes" ).is_object() )
d.attributes = j.at( "attributes" );
d.attributes = AnyMapToStringMap( j.at( "attributes" ) );
}
void EASYEDAPRO::from_json( const nlohmann::json& j, EASYEDAPRO::BLOB& d )
+11 -3
View File
@@ -37,6 +37,8 @@
#include <cctype>
#include <mutex>
#include <utility>
#include <stdlib.h>
#include <wx/log.h>
@@ -113,7 +115,7 @@ KIID::KIID( const std::string& aString ) :
m_uuid(),
m_cached_timestamp( 0 )
{
if( aString.length() == 8
if( !aString.empty() && aString.length() <= 8
&& std::all_of( aString.begin(), aString.end(),
[]( unsigned char c )
{
@@ -123,9 +125,15 @@ KIID::KIID( const std::string& aString ) :
// A legacy-timestamp-based UUID has only the last 4 octets filled in.
// Convert them individually to avoid stepping in the little-endian/big-endian
// doo-doo.
for( int i = 0; i < 4; ++i )
for( int i = 0; i < 4; i++ )
{
std::string octet = aString.substr( i * 2, 2 );
int start = static_cast<int>( aString.length() ) - 8 + i * 2;
int end = start + 2;
start = std::max( 0, start );
int len = std::max( 0, end - start );
std::string octet = aString.substr( start, len );
m_uuid.data[i + 12] = strtol( octet.data(), nullptr, 16 );
}
+12 -3
View File
@@ -33,6 +33,7 @@
#include <lib_table_lexer.h>
#include <macros.h>
#include <string_utils.h>
#include <build_version.h>
#define OPT_SEP '|' ///< options separator character
@@ -434,9 +435,17 @@ bool LIB_TABLE::migrate()
wxString uri = row.GetFullURI( true );
// If the uri still has a variable in it, that means that the user does not have
// these vars defined. We update the old vars to the KICAD7 versions on load
row_updated |= ( uri.Replace( wxS( "${KICAD5_" ), wxS( "${KICAD7_" ), false ) > 0 );
row_updated |= ( uri.Replace( wxS( "${KICAD6_" ), wxS( "${KICAD7_" ), false ) > 0 );
// these vars defined. We update the old vars to the current versions on load
static wxString fmtStr = wxS( "${KICAD%d_" );
int version = 0;
std::tie(version, std::ignore, std::ignore) = GetMajorMinorPatchTuple();
for( int ii = 5; ii < version - 1; ++ii )
{
row_updated |= ( uri.Replace( wxString::Format( fmtStr, ii ),
wxString::Format( fmtStr, version ), false ) > 0 );
}
if( row_updated )
{
+2 -2
View File
@@ -273,7 +273,7 @@ NUMERIC_EVALUATOR::Token NUMERIC_EVALUATOR::getToken()
}
ch = m_token.input[ ++m_token.pos ];
} while( isdigit( ch ) || isDecimalSeparator( ch ) );
} while( isdigit( (unsigned char) ch ) || isDecimalSeparator( ch ) );
m_token.token[ idx ] = 0;
};
@@ -373,7 +373,7 @@ NUMERIC_EVALUATOR::Token NUMERIC_EVALUATOR::getToken()
{
/* End of input */
}
else if( isdigit( ch ) || isDecimalSeparator( ch ) )
else if( isdigit( (unsigned char) ch ) || isDecimalSeparator( ch ) )
{
// VALUE
extractNumber( &siScaler );
+11
View File
@@ -107,6 +107,17 @@ bool MARKER_BASE::HitTestMarker( const VECTOR2I& aHitPosition, int aAccuracy ) c
}
bool MARKER_BASE::HitTestMarker( const BOX2I& aRect, bool aContained, int aAccuracy ) const
{
const BOX2I bbox = GetBoundingBoxMarker().Inflate( aAccuracy );
if( aContained )
return aRect.Contains( bbox );
return aRect.Intersects( bbox );
}
void MARKER_BASE::ShapeToPolygon( SHAPE_LINE_CHAIN& aPolygon, int aScale ) const
{
if( aScale < 0 )
+7
View File
@@ -491,8 +491,15 @@ bool PGM_BASE::InitPgm( bool aHeadless, bool aSkipPyInit, bool aIsUnitTest )
}
#endif
// Ensure the instance checker directory exists
// It should be globally writable because it is shared between all users on Linux, and so on a
// multi-user machine, other need to be able to access it to check for the lock files or make
// their own lock files.
wxString instanceCheckerDir = PATHS::GetInstanceCheckerPath();
PATHS::EnsurePathExists( instanceCheckerDir );
wxChmod( instanceCheckerDir, wxPOSIX_USER_READ | wxPOSIX_USER_WRITE | wxPOSIX_USER_EXECUTE |
wxPOSIX_GROUP_READ | wxPOSIX_GROUP_WRITE | wxPOSIX_GROUP_EXECUTE |
wxPOSIX_OTHERS_READ | wxPOSIX_OTHERS_WRITE | wxPOSIX_OTHERS_EXECUTE );
wxString instanceCheckerName = wxString::Format( wxS( "%s-%s" ), pgm_name,
GetMajorMinorVersion() );
+42 -12
View File
@@ -7,7 +7,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2012 Lorenzo Marcantonio, l.marcantonio@logossrl.com
* Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2023, 2024 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -37,7 +37,8 @@
#include <wx/datstrm.h>
#include <advanced_config.h>
#include <eda_text.h> // for IsGotoPageHref
#include <common.h> // ResolveUriByEnvVars
#include <eda_text.h> // for IsGotoPageHref
#include <font/font.h>
#include <core/ignore.h>
#include <macros.h>
@@ -400,12 +401,12 @@ void PDF_PLOTTER::PlotPoly( const std::vector<VECTOR2I>& aCornerList, FILL_T aFi
SetCurrentLineWidth( aWidth );
VECTOR2D pos = userToDeviceCoordinates( aCornerList[0] );
fprintf( m_workFile, "%g %g m\n", pos.x, pos.y );
fprintf( m_workFile, "%f %f m\n", pos.x, pos.y );
for( unsigned ii = 1; ii < aCornerList.size(); ii++ )
{
pos = userToDeviceCoordinates( aCornerList[ii] );
fprintf( m_workFile, "%g %g l\n", pos.x, pos.y );
fprintf( m_workFile, "%f %f l\n", pos.x, pos.y );
}
// Close path and stroke and/or fill
@@ -438,7 +439,7 @@ void PDF_PLOTTER::PenTo( const VECTOR2I& pos, char plume )
if( m_penState != plume || pos != m_penLastpos )
{
VECTOR2D pos_dev = userToDeviceCoordinates( pos );
fprintf( m_workFile, "%g %g %c\n",
fprintf( m_workFile, "%f %f %c\n",
pos_dev.x, pos_dev.y,
( plume=='D' ) ? 'l' : 'm' );
}
@@ -1332,16 +1333,35 @@ bool PDF_PLOTTER::EndPlot()
{
wxString href = property.substr( property.Find( "http:" ) );
if( m_project )
href = ResolveUriByEnvVars( href, m_project );
js += wxString::Format( wxT( "[\"%s\", \"%s\"],\n" ),
EscapeString( property, CTX_JS_STR ),
EscapeString( href, CTX_JS_STR ),
EscapeString( href, CTX_JS_STR ) );
}
else if( property.Find( "https:" ) >= 0 )
{
wxString href = property.substr( property.Find( "https:" ) );
if( m_project )
href = ResolveUriByEnvVars( href, m_project );
js += wxString::Format( wxT( "[\"%s\", \"%s\"],\n" ),
EscapeString( property, CTX_JS_STR ),
EscapeString( href, CTX_JS_STR ),
EscapeString( href, CTX_JS_STR ) );
}
else if( property.Find( "file:" ) >= 0 )
{
wxString href = property.substr( property.Find( "file:" ) );
if( m_project )
href = ResolveUriByEnvVars( href, m_project );
href = NormalizeFileUri( href );
js += wxString::Format( wxT( "[\"%s\", \"%s\"],\n" ),
EscapeString( href, CTX_JS_STR ),
EscapeString( href, CTX_JS_STR ) );
}
else
@@ -1367,13 +1387,22 @@ bool PDF_PLOTTER::EndPlot()
}
}
}
else if( url.StartsWith( "http:" ) || url.StartsWith( "https:" ) )
else if( url.StartsWith( "http:" ) || url.StartsWith( "https:" )
|| url.StartsWith( "file:" ) )
{
wxString menuText = wxString::Format( _( "Open %s" ), url );
wxString href = url;
if( m_project )
href = ResolveUriByEnvVars( url, m_project );
if( url.StartsWith( "file:" ) )
href = NormalizeFileUri( href );
wxString menuText = wxString::Format( _( "Open %s" ), href );
js += wxString::Format( wxT( "[\"%s\", \"%s\"],\n" ),
EscapeString( menuText, CTX_JS_STR ),
EscapeString( url, CTX_JS_STR ) );
EscapeString( href, CTX_JS_STR ),
EscapeString( href, CTX_JS_STR ) );
}
}
@@ -1413,6 +1442,7 @@ function ShM(aEntries) {
var cChoice = app.popUpMenuEx.apply(app, aParams);
if (cChoice != null && cChoice.substring(0, 1) == '#') this.pageNum = parseInt(cChoice.slice(1));
else if (cChoice != null && cChoice.substring(0, 4) == 'http') app.launchURL(cChoice);
else if (cChoice != null && cChoice.substring(0, 4) == 'file') app.openDoc(cChoice.substring(7));
}
)JS";
@@ -1634,7 +1664,7 @@ void PDF_PLOTTER::Text( const VECTOR2I& aPos,
coordinate system will be used for the overlining. Also the %f
for the trig part of the matrix to avoid %g going in exponential
format (which is not supported) */
fprintf( m_workFile, "q %f %f %f %f %g %g cm BT %s %g Tf %d Tr %g Tz ",
fprintf( m_workFile, "q %f %f %f %f %f %f cm BT %s %g Tf %d Tr %g Tz ",
ctm_a, ctm_b, ctm_c, ctm_d, ctm_e, ctm_f,
fontname, heightFactor, render_mode, wideningFactor * 100 );
+2 -1
View File
@@ -162,7 +162,8 @@ static wxString XmlEsc( const wxString& aStr, bool isAttribute = false )
}
SVG_PLOTTER::SVG_PLOTTER()
SVG_PLOTTER::SVG_PLOTTER( const PROJECT* aProject ) :
PSLIKE_PLOTTER( aProject )
{
m_graphics_changed = true;
SetTextMode( PLOT_TEXT_MODE::STROKE );
+3 -2
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-2023 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2017-2023, 2024 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -44,7 +44,8 @@
#include <callback_gal.h>
#include <math/util.h> // for KiROUND
PLOTTER::PLOTTER( )
PLOTTER::PLOTTER( const PROJECT* aProject ) :
m_project( aProject )
{
m_plotScale = 1;
m_currentPenWidth = -1; // To-be-set marker
+2 -2
View File
@@ -174,12 +174,12 @@ bool PROJECT_ARCHIVER::Archive( const wxString& aSrcDir, const wxString& aDestFi
wxArrayString files;
for( unsigned ii = 0; ii < arrayDim( extensionList ); ii++ )
wxDir::GetAllFiles( aSrcDir, &files, extensionList[ii] );
wxDir::GetAllFiles( aSrcDir, &files, extensionList[ii], wxDIR_FILES | wxDIR_DIRS );
if( aIncludeExtraFiles )
{
for( unsigned ii = 0; ii < arrayDim( extraExtensionList ); ii++ )
wxDir::GetAllFiles( aSrcDir, &files, extraExtensionList[ii] );
wxDir::GetAllFiles( aSrcDir, &files, extraExtensionList[ii], wxDIR_FILES | wxDIR_DIRS );
}
for( unsigned ii = 0; ii < files.GetCount(); ++ii )
+2 -1
View File
@@ -116,7 +116,7 @@ COMMON_SETTINGS::COMMON_SETTINGS() :
m_params.emplace_back( new PARAM<int>( "auto_backup.min_interval",
&m_Backup.min_interval, 300 ) );
m_params.emplace_back( new PARAM_LAMBDA<nlohmann::json>( "environment.vars",
auto envVarsParam = m_params.emplace_back( new PARAM_LAMBDA<nlohmann::json>( "environment.vars",
[&]() -> nlohmann::json
{
nlohmann::json ret = {};
@@ -212,6 +212,7 @@ COMMON_SETTINGS::COMMON_SETTINGS() :
}
},
{} ) );
envVarsParam->SetClearUnknownKeys();
m_params.emplace_back( new PARAM<bool>( "input.focus_follow_sch_pcb",
&m_Input.focus_follow_sch_pcb, false ) );
+14 -8
View File
@@ -75,6 +75,7 @@ JSON_SETTINGS::JSON_SETTINGS( const wxString& aFilename, SETTINGS_LOC aLocation,
m_createIfMissing( aCreateIfMissing ),
m_createIfDefault( aCreateIfDefault ),
m_writeFile( aWriteFile ),
m_modified( false ),
m_deleteLegacyAfterMigration( true ),
m_resetParamsIfMissing( true ),
m_schemaVersion( aSchemaVersion ),
@@ -353,6 +354,8 @@ bool JSON_SETTINGS::LoadFromFile( const wxString& aDirectory )
wxLogTrace( traceSettings, wxT( "Loaded <%s> with schema %d" ), GetFullFilename(),
m_schemaVersion );
m_modified = false;
// If we migrated, clean up the legacy file (with no extension)
if( m_writeFile && ( legacy_migrated || migrated ) )
{
@@ -373,15 +376,13 @@ bool JSON_SETTINGS::LoadFromFile( const wxString& aDirectory )
bool JSON_SETTINGS::Store()
{
bool modified = false;
for( PARAM_BASE* param : m_params )
{
modified |= !param->MatchesFile( this );
m_modified |= !param->MatchesFile( this );
param->Store( this );
}
return modified;
return m_modified;
}
@@ -469,10 +470,12 @@ bool JSON_SETTINGS::SaveToFile( const wxString& aDirectory, bool aForce )
for( PARAM_BASE* param : m_params )
{
if( PARAM_WXSTRING_MAP* stringMap = dynamic_cast<PARAM_WXSTRING_MAP*>( param ) )
if( param->ClearUnknownKeys() )
{
if( stringMap->ClearUnknownKeys() )
toSave[ stringMap->GetJsonPath() ] = nlohmann::json( {} );
nlohmann::json_pointer p
= JSON_SETTINGS_INTERNALS::PointerFromString( param->GetJsonPath() );
toSave[p] = nlohmann::json( {} );
}
}
@@ -504,6 +507,9 @@ bool JSON_SETTINGS::SaveToFile( const wxString& aDirectory, bool aForce )
success = false;
}
if( success )
m_modified = false;
return success;
}
@@ -858,7 +864,7 @@ void JSON_SETTINGS::ReleaseNestedSettings( NESTED_SETTINGS* aSettings )
if( it != m_nested_settings.end() )
{
wxLogTrace( traceSettings, wxT( "Flush and release %s" ), ( *it )->GetFilename() );
( *it )->SaveToFile();
m_modified |= ( *it )->SaveToFile();
m_nested_settings.erase( it );
}
+2 -1
View File
@@ -46,6 +46,7 @@
#include <settings/json_settings_internals.h>
#include <settings/settings_manager.h>
#include <wildcards_and_files_ext.h>
#include <env_vars.h>
SETTINGS_MANAGER::SETTINGS_MANAGER( bool aHeadless ) :
@@ -343,7 +344,7 @@ void SETTINGS_MANAGER::loadAllColorSettings()
wxFileName third_party_path;
const ENV_VAR_MAP& env = Pgm().GetLocalEnvVariables();
auto it = env.find( wxS( "KICAD7_3RD_PARTY" ) );
auto it = env.find( ENV_VAR::GetVersionedEnvVarName( wxS( "3RD_PARTY" ) ) );
if( it != env.end() && !it->second.GetValue().IsEmpty() )
third_party_path.SetPath( it->second.GetValue() );
+91 -14
View File
@@ -28,11 +28,15 @@
#include <clocale>
#include <cmath>
#include <map>
#include <core/map_helpers.h>
#include <fmt/core.h>
#include <macros.h>
#include <richio.h> // StrPrintf
#include <string_utils.h>
#include <wx_filename.h>
#include <fmt/chrono.h>
#include <wx/log.h>
#include <wx/regex.h>
#include "locale_io.h"
@@ -45,6 +49,34 @@
static const char illegalFileNameChars[] = "\\/:\"<>|*?";
// Checks if a full filename is valid, i.e. does not contains illegal chars
bool IsFullFileNameValid( const wxString& aFullFilename )
{
// Test for forbidden chars in aFullFilename.
// '\'and '/' are allowed here because aFullFilename can be a full path, and
// ':' is allowed on Windows as second char in string.
// So remove allowed separators from string to test
wxString filtered_fullpath = aFullFilename;
#ifdef __WINDOWS__
// On MSW, the list returned by wxFileName::GetForbiddenChars() contains separators
// '\'and '/'
filtered_fullpath.Replace( "/", "_" );
filtered_fullpath.Replace( "\\", "_" );
// A disk identifier is allowed, and therefore remove its separator
if( filtered_fullpath.Length() > 1 && filtered_fullpath[1] == ':' )
filtered_fullpath[1] = ' ';
#endif
if( wxString::npos != filtered_fullpath.find_first_of( wxFileName::GetForbiddenChars() ) )
return false;
return true;
}
wxString ConvertToNewOverbarNotation( const wxString& aOldStr )
{
wxString newStr;
@@ -540,22 +572,32 @@ wxString UnescapeHTML( const wxString& aString )
{
wxString converted = aString;
converted.Replace( wxS( "&quot;" ), wxS( "\"" ) );
converted.Replace( wxS( "&apos;" ), wxS( "'" ) );
converted.Replace( wxS( "&amp;" ), wxS( "&" ) );
converted.Replace( wxS( "&lt;" ), wxS( "<" ) );
converted.Replace( wxS( "&gt;" ), wxS( ">" ) );
// clang-format off
static const std::map<wxString, wxString> c_replacements = {
{ wxS( "quot" ), wxS( "\"" ) },
{ wxS( "apos" ), wxS( "'" ) },
{ wxS( "amp" ), wxS( "&" ) },
{ wxS( "lt" ), wxS( "<" ) },
{ wxS( "gt" ), wxS( ">" ) }
};
// clang-format on
// Yes, &amp;#123; is going to give unexpected results.
// Construct regex
wxString regexStr = "&(#(\\d*)|#x([a-zA-Z0-9]{4})";
wxString result;
for( auto& [key, value] : c_replacements )
regexStr << '|' << key;
wxRegEx regex( "&#(\\d*);" );
regexStr << ");";
wxRegEx regex( regexStr );
// Process matches
size_t start = 0;
size_t len = 0;
wxString str = aString;
wxString result;
wxString str = converted;
while( regex.Matches( str ) )
{
@@ -564,12 +606,26 @@ wxString UnescapeHTML( const wxString& aString )
result << str.Left( start );
unsigned long codeVal = 0;
wxString code = regex.GetMatch( str, 1 );
code.ToCULong( &codeVal );
wxString code = regex.GetMatch( str, 1 );
wxString codeDec = regex.GetMatch( str, 2 );
wxString codeHex = regex.GetMatch( str, 3 );
if( codeVal != 0 )
result << wxUniChar( codeVal );
if( !codeDec.IsEmpty() || !codeHex.IsEmpty() )
{
unsigned long codeVal = 0;
if( !codeDec.IsEmpty() )
codeDec.ToCULong( &codeVal );
else if( !codeHex.IsEmpty() )
codeHex.ToCULong( &codeVal, 16 );
if( codeVal != 0 )
result << wxUniChar( codeVal );
}
else if( auto val = get_opt( c_replacements, code ) )
{
result << *val;
}
str = str.Mid( start + len );
}
@@ -1400,3 +1456,24 @@ wxString From_UTF8( const std::string& aString )
return line;
}
wxString NormalizeFileUri( const wxString& aFileUri )
{
wxString uriPathAndFileName;
wxCHECK( aFileUri.StartsWith( wxS( "file://" ), &uriPathAndFileName ), aFileUri );
wxString tmp = uriPathAndFileName;
wxString retv = wxS( "file://" );
tmp.Replace( wxS( "\\" ), wxS( "/" ) );
tmp.Replace( wxS( ":" ), wxS( "" ) );
if( !tmp.IsEmpty() && tmp[0] != '/' )
tmp = wxS( "/" ) + tmp;
retv += tmp;
return retv;
}
+8 -6
View File
@@ -48,7 +48,7 @@ ACTION_MANAGER::ACTION_MANAGER( TOOL_MANAGER* aToolManager ) :
std::string groupName = "none";
std::optional<TOOL_ACTION_GROUP> group = action->GetActionGroup();
if( group.has_value() )
{
groupID = group.value().GetGroupID();
@@ -152,19 +152,21 @@ bool ACTION_MANAGER::RunHotKey( int aHotKey ) const
// If no luck, try without Shift, to handle keys that require it
// e.g. to get ? you need to press Shift+/ without US keyboard layout
// Hardcoding ? as Shift+/ is a bad idea, as on another layout you may need to press a
// different combination
if( it == m_actionHotKeys.end() )
// different combination.
// This doesn't apply for letters, as we already handled case normalisation.
if( it == m_actionHotKeys.end() && !std::isalpha( key ) )
{
wxLogTrace( kicadTraceToolStack,
wxS( "ACTION_MANAGER::RunHotKey No actions found, searching with key: %s" ),
KeyNameFromKeyCode( key | ( mod & ~MD_SHIFT ) ) );
it = m_actionHotKeys.find( key | ( mod & ~MD_SHIFT ) );
if( it == m_actionHotKeys.end() )
return false; // no appropriate action found for the hotkey
}
// Still no luck, we're done without a match
if( it == m_actionHotKeys.end() )
return false; // no appropriate action found for the hotkey
const std::list<TOOL_ACTION*>& actions = it->second;
// Choose the action that has the highest priority on the active tools stack
+18 -5
View File
@@ -38,6 +38,8 @@
#include <wx/textentry.h>
#include <wx/log.h>
#include <wx/combo.h>
#include <wx/msgdlg.h>
#include <refdes_utils.h>
FOOTPRINT_NAME_VALIDATOR::FOOTPRINT_NAME_VALIDATOR( wxString* aValue ) :
@@ -355,18 +357,24 @@ bool FIELD_VALIDATOR::Validate( wxWindow* aParent )
return false;
wxString val( text->GetValue() );
return DoValidate( val, aParent );
}
bool FIELD_VALIDATOR::DoValidate( const wxString& aValue, wxWindow* aParent )
{
wxString msg;
if( HasFlag( wxFILTER_EMPTY ) && val.empty() )
if( HasFlag( wxFILTER_EMPTY ) && aValue.empty() )
msg.Printf( _( "The value of the field cannot be empty." ) );
if( HasFlag( wxFILTER_EXCLUDE_CHAR_LIST ) && ContainsExcludedCharacters( val ) )
if( HasFlag( wxFILTER_EXCLUDE_CHAR_LIST ) && ContainsExcludedCharacters( aValue ) )
{
wxArrayString badCharsFound;
for( const wxUniCharRef& excludeChar : GetCharExcludes() )
{
if( val.Find( excludeChar ) != wxNOT_FOUND )
if( aValue.Find( excludeChar ) != wxNOT_FOUND )
{
if( excludeChar == '\r' )
badCharsFound.Add( _( "carriage return" ) );
@@ -434,14 +442,19 @@ bool FIELD_VALIDATOR::Validate( wxWindow* aParent )
break;
};
}
else if( m_fieldId == REFERENCE_FIELD && val.Contains( wxT( "${" ) ) )
else if( m_fieldId == REFERENCE_FIELD && aValue.Contains( wxT( "${" ) ) )
{
msg.Printf( _( "The reference designator cannot contain text variable references" ) );
}
else if( m_fieldId == REFERENCE_FIELD && UTIL::GetRefDesPrefix( aValue ).IsEmpty() )
{
msg.Printf( _( "References must start with a letter." ) );
}
if( !msg.empty() )
{
m_validatorWindow->SetFocus();
if( m_validatorWindow )
m_validatorWindow->SetFocus();
wxMessageBox( msg, _( "Field Validation Error" ), wxOK | wxICON_EXCLAMATION, aParent );
+2
View File
@@ -694,6 +694,8 @@ void VIEW::ReorderLayerData( std::unordered_map<int, int> aReorderMap )
// Transfer reordered data (using the copy assignment operator ):
m_layers = new_map;
sortLayers();
for( VIEW_ITEM* item : *m_allItems )
{
VIEW_ITEM_DATA* viewData = item->viewPrivData();
+37 -28
View File
@@ -36,9 +36,6 @@ FOOTPRINT_PREVIEW_WIDGET::FOOTPRINT_PREVIEW_WIDGET( wxWindow* aParent, KIWAY& aK
{
m_prev_panel = FOOTPRINT_PREVIEW_PANEL_BASE::Create( this, aKiway );
if( !m_prev_panel )
return;
m_statusPanel = new wxPanel( this );
m_status = new wxStaticText( m_statusPanel, wxID_ANY, wxEmptyString );
m_statusSizer = new wxBoxSizer( wxVERTICAL );
@@ -47,19 +44,25 @@ FOOTPRINT_PREVIEW_WIDGET::FOOTPRINT_PREVIEW_WIDGET( wxWindow* aParent, KIWAY& aK
m_statusSizer->Add( 0, 0, 1 ); // add a spacer
m_statusPanel->SetSizer( m_statusSizer );
// Give the status panel the same color scheme as the canvas so it isn't jarring when
// switched to
m_statusPanel->SetBackgroundColour( m_prev_panel->GetBackgroundColor().ToColour() );
m_statusPanel->SetForegroundColour( m_prev_panel->GetForegroundColor().ToColour() );
m_status->SetForegroundColour( m_prev_panel->GetForegroundColor().ToColour() );
if( m_prev_panel )
{
// Give the status panel the same color scheme as the canvas so it isn't jarring when
// switched to
m_statusPanel->SetBackgroundColour( m_prev_panel->GetBackgroundColor().ToColour() );
m_statusPanel->SetForegroundColour( m_prev_panel->GetForegroundColor().ToColour() );
m_status->SetForegroundColour( m_prev_panel->GetForegroundColor().ToColour() );
// Set our background so wx doesn't render a normal control background momentarily when
// rapidly navigating with arrow keys
SetBackgroundColour( m_prev_panel->GetBackgroundColor().ToColour() );
SetForegroundColour( m_prev_panel->GetForegroundColor().ToColour() );
// Set our background so wx doesn't render a normal control background momentarily when
// rapidly navigating with arrow keys
SetBackgroundColour( m_prev_panel->GetBackgroundColor().ToColour() );
SetForegroundColour( m_prev_panel->GetForegroundColor().ToColour() );
}
m_outerSizer = new wxBoxSizer( wxVERTICAL );
m_outerSizer->Add( m_prev_panel->GetWindow(), 1, wxALL | wxEXPAND, 0 );
if( m_prev_panel )
m_outerSizer->Add( m_prev_panel->GetWindow(), 1, wxALL | wxEXPAND, 0 );
m_outerSizer->Add( m_statusPanel, 1, wxALL | wxEXPAND, 0 );
SetSizer( m_outerSizer );
@@ -72,7 +75,10 @@ void FOOTPRINT_PREVIEW_WIDGET::SetStatusText( wxString const& aText )
{
m_status->SetLabel( aText );
m_statusPanel->Show();
m_prev_panel->GetWindow()->Hide();
if( m_prev_panel )
m_prev_panel->GetWindow()->Hide();
Layout();
}
@@ -81,20 +87,25 @@ void FOOTPRINT_PREVIEW_WIDGET::ClearStatus()
{
m_status->SetLabel( wxEmptyString );
m_statusPanel->Hide();
m_prev_panel->GetWindow()->Show();
if( m_prev_panel )
m_prev_panel->GetWindow()->Show();
Layout();
}
void FOOTPRINT_PREVIEW_WIDGET::SetUserUnits( EDA_UNITS aUnits )
{
m_prev_panel->SetUserUnits( aUnits );
if( m_prev_panel )
m_prev_panel->SetUserUnits( aUnits );
}
void FOOTPRINT_PREVIEW_WIDGET::SetPinFunctions( const std::map<wxString, wxString>& aPinFunctions )
{
m_prev_panel->SetPinFunctions( aPinFunctions );
if( m_prev_panel )
m_prev_panel->SetPinFunctions( aPinFunctions );
}
@@ -122,34 +133,32 @@ void FOOTPRINT_PREVIEW_WIDGET::DisplayFootprints( std::shared_ptr<FOOTPRINT> aFo
std::shared_ptr<FOOTPRINT> aFootprintB )
{
ClearStatus();
m_prev_panel->DisplayFootprints( aFootprintA, aFootprintB );
if( m_prev_panel )
m_prev_panel->DisplayFootprints( aFootprintA, aFootprintB );
}
void FOOTPRINT_PREVIEW_WIDGET::RefreshAll()
{
m_prev_panel->RefreshAll();
if( m_prev_panel )
m_prev_panel->RefreshAll();
}
FOOTPRINT_PREVIEW_PANEL_BASE* FOOTPRINT_PREVIEW_PANEL_BASE::Create( wxWindow* aParent,
KIWAY& aKiway )
{
FOOTPRINT_PREVIEW_PANEL_BASE* panel = nullptr;
wxWindow* panel = nullptr;
try
{
KIFACE* kiface = aKiway.KiFACE( KIWAY::FACE_PCB );
wxWindow* window = kiface->CreateKiWindow( aParent, FRAME_FOOTPRINT_PREVIEW, &aKiway );
panel = dynamic_cast<FOOTPRINT_PREVIEW_PANEL_BASE*>( window );
if( window && !panel )
delete window;
if( KIFACE* kiface = aKiway.KiFACE( KIWAY::FACE_PCB ) )
panel = kiface->CreateKiWindow( aParent, FRAME_FOOTPRINT_PREVIEW, &aKiway );
}
catch( ... )
{
}
return panel;
return dynamic_cast<FOOTPRINT_PREVIEW_PANEL_BASE*>( panel );
}
+2 -14
View File
@@ -300,18 +300,6 @@ WIDGET_HOTKEY_CLIENT_DATA* WIDGET_HOTKEY_LIST::getHKClientData( wxTreeListItem a
}
WIDGET_HOTKEY_CLIENT_DATA* WIDGET_HOTKEY_LIST::getExpectedHkClientData( wxTreeListItem aItem )
{
const auto hkdata = getHKClientData( aItem );
// This probably means a hotkey-only action is being attempted on
// a row that is not a hotkey (like a section heading)
wxASSERT_MSG( hkdata != nullptr, "No hotkey data found for list item" );
return hkdata;
}
void WIDGET_HOTKEY_LIST::updateFromClientData()
{
for( wxTreeListItem i = GetFirstItem(); i.IsOk(); i = GetNextItem( i ) )
@@ -369,7 +357,7 @@ void WIDGET_HOTKEY_LIST::changeHotkey( HOTKEY& aHotkey, long aKey, bool alternat
void WIDGET_HOTKEY_LIST::editItem( wxTreeListItem aItem, int aEditId )
{
WIDGET_HOTKEY_CLIENT_DATA* hkdata = getExpectedHkClientData( aItem );
WIDGET_HOTKEY_CLIENT_DATA* hkdata = getHKClientData( aItem );
if( !hkdata )
return;
@@ -403,7 +391,7 @@ void WIDGET_HOTKEY_LIST::editItem( wxTreeListItem aItem, int aEditId )
void WIDGET_HOTKEY_LIST::resetItem( wxTreeListItem aItem, int aResetId )
{
WIDGET_HOTKEY_CLIENT_DATA* hkdata = getExpectedHkClientData( aItem );
WIDGET_HOTKEY_CLIENT_DATA* hkdata = getHKClientData( aItem );
if( !hkdata )
return;
+1
View File
@@ -125,6 +125,7 @@ wxString AddFileExtListToFilter( const std::vector<std::string>& aExts )
const std::string FILEEXT::BackupFileSuffix( "-bak" );
const std::string FILEEXT::LockFilePrefix( "~" );
const std::string FILEEXT::LockFileExtension( "lck" );
const std::string FILEEXT::AutoSaveFilePrefix( "_autosave-" );
const std::string FILEEXT::KiCadSymbolLibFileExtension( "kicad_sym" );
const std::string FILEEXT::SchematicSymbolFileExtension( "sym" );
+7 -6
View File
@@ -371,20 +371,20 @@ void DISPLAY_FOOTPRINTS_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
WINDOW_SETTINGS* DISPLAY_FOOTPRINTS_FRAME::GetWindowSettings( APP_SETTINGS_BASE* aCfg )
{
CVPCB_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<CVPCB_SETTINGS>();
CVPCB_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<CVPCB_SETTINGS>( "cvpcb" );
return &cfg->m_FootprintViewer;
}
PCB_VIEWERS_SETTINGS_BASE* DISPLAY_FOOTPRINTS_FRAME::GetViewerSettingsBase() const
{
return Pgm().GetSettingsManager().GetAppSettings<CVPCB_SETTINGS>();
return Pgm().GetSettingsManager().GetAppSettings<CVPCB_SETTINGS>( "cvpcb" );
}
MAGNETIC_SETTINGS* DISPLAY_FOOTPRINTS_FRAME::GetMagneticItemsSettings()
{
CVPCB_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<CVPCB_SETTINGS>();
CVPCB_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<CVPCB_SETTINGS>( "cvpcb" );
return &cfg->m_FootprintViewerMagneticSettings;
}
@@ -525,6 +525,7 @@ void DISPLAY_FOOTPRINTS_FRAME::InitDisplay()
}
GetBoard()->Add( footprint );
GetCanvas()->GetView()->Update( footprint );
m_currentFootprint = footprintName;
m_currentComp = comp;
setFPWatcher( footprint );
@@ -579,10 +580,10 @@ void DISPLAY_FOOTPRINTS_FRAME::UpdateMsgPanel()
COLOR_SETTINGS* DISPLAY_FOOTPRINTS_FRAME::GetColorSettings( bool aForceRefresh ) const
{
auto* settings = Pgm().GetSettingsManager().GetAppSettings<FOOTPRINT_EDITOR_SETTINGS>();
auto* cfg = Pgm().GetSettingsManager().GetAppSettings<FOOTPRINT_EDITOR_SETTINGS>( "fpedit" );
if( settings )
return Pgm().GetSettingsManager().GetColorSettings( settings->m_ColorTheme );
if( cfg )
return Pgm().GetSettingsManager().GetColorSettings( cfg->m_ColorTheme );
else
return Pgm().GetSettingsManager().GetColorSettings();
}
+44 -38
View File
@@ -275,7 +275,9 @@ void CONNECTION_SUBGRAPH::getAllConnectedItems( std::set<std::pair<SCH_SHEET_PAT
while( sg->m_absorbed_by )
{
wxASSERT( sg->m_graph == sg->m_absorbed_by->m_graph );
// Using wxCHECK2 with continue statement causes a crash later in the connection
// graph rebuild. See https://gitlab.com/kicad/code/kicad/-/issues/18136.
wxCHECK( sg->m_graph == sg->m_absorbed_by->m_graph, /* void */ );
sg = sg->m_absorbed_by;
}
@@ -453,7 +455,7 @@ const wxString CONNECTION_SUBGRAPH::GetNetclassForDriver( SCH_ITEM* aItem ) cons
void CONNECTION_SUBGRAPH::Absorb( CONNECTION_SUBGRAPH* aOther )
{
wxASSERT( m_sheet == aOther->m_sheet );
wxCHECK( m_sheet == aOther->m_sheet, /* void */ );
for( SCH_ITEM* item : aOther->m_items )
{
@@ -752,9 +754,9 @@ void CONNECTION_GRAPH::Recalculate( const SCH_SHEET_LIST& aSheetList, bool aUnco
}
else if( item->Type() == SCH_SHEET_T )
{
SCH_SHEET* sheet = static_cast<SCH_SHEET*>( item );
SCH_SHEET* sheetItem = static_cast<SCH_SHEET*>( item );
for( SCH_SHEET_PIN* pin : sheet->GetPins() )
for( SCH_SHEET_PIN* pin : sheetItem->GetPins() )
{
if( pin->IsConnectivityDirty() )
{
@@ -827,14 +829,14 @@ std::set<std::pair<SCH_SHEET_PATH, SCH_ITEM*>> CONNECTION_GRAPH::ExtractAffected
// Find the primary subgraph on this sheet
while( aSubgraph->m_absorbed_by )
{
wxASSERT( aSubgraph->m_graph == aSubgraph->m_absorbed_by->m_graph );
wxCHECK2( aSubgraph->m_graph == aSubgraph->m_absorbed_by->m_graph, continue );
aSubgraph = aSubgraph->m_absorbed_by;
}
// Find the top most connected subgraph on all sheets
while( aSubgraph->m_hier_parent )
{
wxASSERT( aSubgraph->m_graph == aSubgraph->m_hier_parent->m_graph );
wxCHECK2( aSubgraph->m_graph == aSubgraph->m_hier_parent->m_graph, continue );
aSubgraph = aSubgraph->m_hier_parent;
}
@@ -848,9 +850,11 @@ std::set<std::pair<SCH_SHEET_PATH, SCH_ITEM*>> CONNECTION_GRAPH::ExtractAffected
if( !item_sg )
{
wxLogTrace( ConnTrace, wxT( "Item %s not found in connection graph" ), aItem->GetTypeDesc() );
wxLogTrace( ConnTrace, wxT( "Item %s not found in connection graph" ),
aItem->GetTypeDesc() );
return;
}
if( !item_sg->ResolveDrivers( true ) )
{
wxLogTrace( ConnTrace, wxT( "Item %s in subgraph %ld (%p) has no driver" ),
@@ -1333,12 +1337,12 @@ void CONNECTION_GRAPH::buildItemSubGraphs()
// Recache all bus aliases for later use
wxCHECK_RET( m_schematic, wxS( "Connection graph cannot be built without schematic pointer" ) );
SCH_SHEET_LIST all_sheets = m_schematic->GetSheets();
SCH_SCREENS screens( m_schematic->Root() );
for( unsigned i = 0; i < all_sheets.size(); i++ )
for( SCH_SCREEN* screen = screens.GetFirst(); screen; screen = screens.GetNext() )
{
for( const std::shared_ptr<BUS_ALIAS>& alias : all_sheets[i].LastScreen()->GetBusAliases() )
m_bus_alias_cache[ alias->GetName() ] = alias;
for( const std::shared_ptr<BUS_ALIAS>& alias : screen->GetBusAliases() )
m_bus_alias_cache[alias->GetName()] = alias;
}
// Build subgraphs from items (on a per-sheet basis)
@@ -1386,7 +1390,7 @@ void CONNECTION_GRAPH::buildItemSubGraphs()
SCH_CONNECTION* connected_conn = connected_item->Connection( &sheet );
wxASSERT( connected_conn );
wxCHECK2( connected_conn, continue );
if( connected_conn->SubgraphCode() == 0 )
{
@@ -1536,7 +1540,7 @@ void CONNECTION_GRAPH::collectAllDriverValues()
case SCH_PIN_T:
{
SCH_PIN* pin = static_cast<SCH_PIN*>( driver );
wxASSERT( pin->IsGlobalPower() );
wxCHECK( pin->IsGlobalPower(), /* void */ );
m_global_label_cache[name].push_back( subgraph );
break;
}
@@ -1972,9 +1976,10 @@ void CONNECTION_GRAPH::processSubGraphs()
}
else
{
wxASSERT( driver->Type() == SCH_LABEL_T ||
wxCHECK2( driver->Type() == SCH_LABEL_T ||
driver->Type() == SCH_GLOBAL_LABEL_T ||
driver->Type() == SCH_HIER_LABEL_T );
driver->Type() == SCH_HIER_LABEL_T,
continue );
if( subgraph->GetNameForDriver( driver ) == test_name )
{
@@ -1996,7 +2001,7 @@ void CONNECTION_GRAPH::processSubGraphs()
subgraph->m_bus_neighbors[member].insert( candidate );
candidate->m_bus_parents[member].insert( subgraph );
}
else if( connection->Type() == candidate->m_driver_connection->Type() )
else if( !connection->IsBus() || connection->Type() == candidate->m_driver_connection->Type() )
{
wxLogTrace( ConnTrace, wxS( "%lu (%s) absorbs neighbor %lu (%s)" ),
subgraph->m_code, connection->Name(),
@@ -2051,12 +2056,12 @@ void CONNECTION_GRAPH::buildConnectionGraph( std::function<void( SCH_ITEM* )>* a
// Recache all bus aliases for later use
wxCHECK_RET( m_schematic, wxT( "Connection graph cannot be built without schematic pointer" ) );
SCH_SHEET_LIST all_sheets = m_schematic->GetSheets();
SCH_SCREENS screens( m_schematic->Root() );
for( unsigned i = 0; i < all_sheets.size(); i++ )
for( SCH_SCREEN* screen = screens.GetFirst(); screen; screen = screens.GetNext() )
{
for( const std::shared_ptr<BUS_ALIAS>& alias : all_sheets[i].LastScreen()->GetBusAliases() )
m_bus_alias_cache[ alias->GetName() ] = alias;
for( const std::shared_ptr<BUS_ALIAS>& alias : screen->GetBusAliases() )
m_bus_alias_cache[alias->GetName()] = alias;
}
PROF_TIMER sub_graph( "buildItemSubGraphs" );
@@ -2154,18 +2159,19 @@ void CONNECTION_GRAPH::buildConnectionGraph( std::function<void( SCH_ITEM* )>* a
if( !secondary_is_global && candidate->m_sheet != subgraph->m_sheet )
continue;
SCH_CONNECTION* conn = candidate->m_driver_connection;
if( conn->Name() == secondary_name )
for( SCH_ITEM* candidate_driver : candidate->m_drivers )
{
wxLogTrace( ConnTrace, wxS( "Global %lu (%s) promoted to %s" ),
candidate->m_code, conn->Name(),
subgraph->m_driver_connection->Name() );
if( candidate->GetNameForDriver( candidate_driver ) == secondary_name )
{
wxLogTrace( ConnTrace, wxS( "Global %lu (%s) promoted to %s" ),
candidate->m_code, candidate->m_driver_connection->Name(),
subgraph->m_driver_connection->Name() );
conn->Clone( *subgraph->m_driver_connection );
candidate->m_driver_connection->Clone( *subgraph->m_driver_connection );
candidate->m_dirty = false;
propagateToNeighbors( candidate, false );
candidate->m_dirty = false;
propagateToNeighbors( candidate, false );
}
}
}
}
@@ -2197,7 +2203,7 @@ void CONNECTION_GRAPH::buildConnectionGraph( std::function<void( SCH_ITEM* )>* a
for( CONNECTION_SUBGRAPH* subgraph : m_driver_subgraphs )
{
// All SGs should have been processed by propagateToNeighbors above
wxASSERT_MSG( !subgraph->m_dirty,
wxCHECK2_MSG( !subgraph->m_dirty, continue,
wxS( "Subgraph not processed by propagateToNeighbors!" ) );
if( subgraph->m_bus_parents.size() < 2 )
@@ -2208,7 +2214,7 @@ void CONNECTION_GRAPH::buildConnectionGraph( std::function<void( SCH_ITEM* )>* a
wxLogTrace( ConnTrace, wxS( "%lu (%s) has multiple bus parents" ),
subgraph->m_code, conn->Name() );
wxASSERT( conn->IsNet() );
wxCHECK2( conn->IsNet(), continue );
for( const auto& ii : subgraph->m_bus_parents )
{
@@ -2574,7 +2580,7 @@ void CONNECTION_GRAPH::propagateToNeighbors( CONNECTION_SUBGRAPH* aSubgraph, boo
candidate->m_hier_parent = aParent;
aParent->m_hier_children.insert( candidate );
wxASSERT( candidate->m_graph == aParent->m_graph );
wxCHECK2( candidate->m_graph == aParent->m_graph, continue );
search_list.push_back( candidate );
break;
@@ -2692,7 +2698,7 @@ void CONNECTION_GRAPH::propagateToNeighbors( CONNECTION_SUBGRAPH* aSubgraph, boo
continue;
// Safety check against infinite recursion
wxASSERT( neighbor_conn->IsNet() );
wxCHECK2( neighbor_conn->IsNet(), continue );
wxLogTrace( ConnTrace, wxS( "%lu (%s) connected to bus member %s (local %s)" ),
neighbor->m_code, neighbor_name, member->Name(), member->LocalName() );
@@ -2902,7 +2908,7 @@ std::shared_ptr<SCH_CONNECTION> CONNECTION_GRAPH::getDefaultConnection( SCH_ITEM
SCH_CONNECTION* CONNECTION_GRAPH::matchBusMember( SCH_CONNECTION* aBusConnection,
SCH_CONNECTION* aSearch )
{
wxASSERT( aBusConnection->IsBus() );
wxCHECK( aBusConnection->IsBus(), nullptr );
SCH_CONNECTION* match = nullptr;
@@ -2984,7 +2990,7 @@ std::vector<const CONNECTION_SUBGRAPH*> CONNECTION_GRAPH::GetBusesNeedingMigrati
for( CONNECTION_SUBGRAPH* subgraph : m_subgraphs )
{
// Graph is supposed to be up-to-date before calling this
wxASSERT( !subgraph->m_dirty );
wxCHECK2( !subgraph->m_dirty, continue );
if( !subgraph->m_driver )
continue;
@@ -3062,7 +3068,7 @@ CONNECTION_SUBGRAPH* CONNECTION_GRAPH::FindSubgraphByName( const wxString& aNetN
for( CONNECTION_SUBGRAPH* sg : it->second )
{
// Cache is supposed to be valid by now
wxASSERT( sg && !sg->m_absorbed && sg->m_driver_connection );
wxCHECK2( sg && !sg->m_absorbed && sg->m_driver_connection, continue );
if( sg->m_sheet == aPath && sg->m_driver_connection->Name() == aNetName )
return sg;
@@ -3079,7 +3085,7 @@ CONNECTION_SUBGRAPH* CONNECTION_GRAPH::FindFirstSubgraphByName( const wxString&
if( it == m_net_name_to_subgraphs_map.end() )
return nullptr;
wxASSERT( !it->second.empty() );
wxCHECK( !it->second.empty(), nullptr );
return it->second[0];
}
@@ -3129,7 +3135,7 @@ int CONNECTION_GRAPH::RunERC()
wxCHECK2( subgraph, continue );
// Graph is supposed to be up-to-date before calling RunERC()
wxASSERT( !subgraph->m_dirty );
wxCHECK2( !subgraph->m_dirty, continue );
if( subgraph->m_absorbed )
continue;
+12
View File
@@ -466,6 +466,18 @@ public:
*/
void ExchangeItem( SCH_ITEM* aOldItem, SCH_ITEM* aNewItem );
/**
* We modify how we handle the connectivity graph for small graphs vs large
* graphs. Partially this is to avoid unneeded complexity for small graphs,
* where the performance of the graph is not a concern. This is considered
* a temporary solution until the connectivity graph is refactored with an
* eye toward partial updates
*/
bool IsMinor() const
{
return m_items.size() < 10000;
}
private:
/**
* Update the graphical connectivity between items (i.e. where they touch)
+1 -12
View File
@@ -353,19 +353,8 @@ bool DIALOG_FIELD_PROPERTIES::TransferDataFromWindow()
else if( m_StyledTextCtrl->IsShown() )
m_text = UnescapeString( m_StyledTextCtrl->GetValue() );
if( m_fieldId == REFERENCE_FIELD )
{
// Test if the reference string is valid:
if( !SCH_SYMBOL::IsReferenceStringValid( m_text ) )
{
DisplayError( this, _( "Illegal reference designator value!" ) );
return false;
}
}
else if( m_fieldId == SHEETFILENAME_V )
{
if( m_fieldId == SHEETFILENAME_V )
m_text = EnsureFileExtension( m_text, FILEEXT::KiCadSchematicFileExtension );
}
m_position = VECTOR2I( m_posX.GetValue(), m_posY.GetValue() );
m_size = m_textSize.GetValue();
@@ -35,7 +35,7 @@
#include <widgets/std_bitmap_button.h>
#include <string_utils.h>
#include <project_sch.h>
#include <refdes_utils.h>
#include <dialog_sim_model.h>
#include <dialog_lib_symbol_properties.h>
@@ -238,8 +238,8 @@ bool DIALOG_LIB_SYMBOL_PROPERTIES::Validate()
return false;
// Alias symbol reference can be empty because it inherits from the parent symbol.
if( m_libEntry->IsRoot() &&
!SCH_SYMBOL::IsReferenceStringValid( m_fields->at( REFERENCE_FIELD ).GetText() ) )
if( m_libEntry->IsRoot()
&& UTIL::GetRefDesPrefix( m_fields->at( REFERENCE_FIELD ).GetText() ).IsEmpty() )
{
if( m_NoteBook->GetSelection() != 0 )
m_NoteBook->SetSelection( 0 );
+10 -1
View File
@@ -44,6 +44,7 @@
#include <trace_helpers.h>
#include "panel_eeschema_color_settings.h"
#include "wx/dcclient.h"
#include "string_utils.h"
DIALOG_SHEET_PROPERTIES::DIALOG_SHEET_PROPERTIES( SCH_EDIT_FRAME* aParent, SCH_SHEET* aSheet,
bool* aClearAnnotationNewItems,
@@ -286,7 +287,15 @@ bool DIALOG_SHEET_PROPERTIES::TransferDataFromWindow()
// but unedited data from existing files can be bad.)
sheetFileName = EnsureFileExtension( sheetFileName, FILEEXT::KiCadSchematicFileExtension );
// Ensure sheetFileName is legal
if( !IsFullFileNameValid( sheetFileName ) )
{
DisplayError( this, _( "A sheet must have a valid file name." ) );
return false;
}
wxFileName fn( sheetFileName );
wxString newRelativeFilename = fn.GetFullPath();
// Inside Eeschema, filenames are stored using unix notation
@@ -425,7 +434,7 @@ bool DIALOG_SHEET_PROPERTIES::TransferDataFromWindow()
for( SCH_ITEM* item : m_frame->GetScreen()->Items().OfType( SCH_SHEET_T ) )
m_frame->UpdateItem( item );
if( isUndoable )
if( isUndoable && !m_sheet->IsNew() )
{
commit.Push( _( "Edit Sheet Properties" ) );
}
+1 -1
View File
@@ -461,7 +461,7 @@ void DIALOG_SIM_MODEL<T_symbol, T_field>::updateWidgets()
updateBuiltinModelWidgets( model );
updateModelParamsTab( model );
updateModelCodeTab( model );
updatePinAssignments( model, false );
updatePinAssignments( model, model != m_prevModel );
std::string ref = SIM_MODEL::GetFieldValue( &m_fields, SIM_REFERENCE_FIELD );
@@ -634,17 +634,6 @@ bool DIALOG_SYMBOL_PROPERTIES::Validate()
if( !m_fieldsGrid->CommitPendingChanges() || !m_fieldsGrid->Validate() )
return false;
if( !SCH_SYMBOL::IsReferenceStringValid( m_fields->at( REFERENCE_FIELD ).GetText() ) )
{
DisplayErrorMessage( this, _( "References must start with a letter." ) );
wxCommandEvent *evt = new wxCommandEvent( SYMBOL_DELAY_FOCUS );
evt->SetClientData( new VECTOR2I( REFERENCE_FIELD, FDC_VALUE ) );
QueueEvent( evt );
return false;
}
// Check for missing field names.
for( size_t i = MANDATORY_FIELDS; i < m_fields->size(); ++i )
{
+59 -2
View File
@@ -26,6 +26,7 @@
#include <schematic.h>
#include <dialogs/panel_setup_buses.h>
#include "grid_tricks.h"
#include <wx/clipbrd.h>
PANEL_SETUP_BUSES::PANEL_SETUP_BUSES( wxWindow* aWindow, SCH_EDIT_FRAME* aFrame ) :
PANEL_SETUP_BUSES_BASE( aWindow ),
@@ -147,6 +148,9 @@ bool PANEL_SETUP_BUSES::TransferDataFromWindow()
for( int ii = 0; ii < m_aliasesGrid->GetNumberRows(); ++ii )
m_aliases[ii]->SetName( m_aliasesGrid->GetCellValue( ii, 0 ) );
// Associate the respective members with the last alias that is active.
updateAliasMembers( m_lastAlias );
SCH_SCREENS screens( m_frame->Schematic().Root() );
for( SCH_SCREEN* screen = screens.GetFirst(); screen != nullptr; screen = screens.GetNext() )
@@ -168,6 +172,12 @@ void PANEL_SETUP_BUSES::OnAddAlias( wxCommandEvent& aEvent )
m_aliases.push_back( std::make_shared<BUS_ALIAS>( m_frame->GetScreen() ) );
int row = m_aliasesGrid->GetNumberRows();
// Associate the respective members with the previous alias. This ensures that the association starts
// correctly when adding more than one row
if( row > 0 )
updateAliasMembers( row - 1 );
m_aliasesGrid->AppendRows();
m_aliasesGrid->MakeCellVisible( row, 0 );
@@ -216,8 +226,35 @@ void PANEL_SETUP_BUSES::OnAddMember( wxCommandEvent& aEvent )
m_membersGrid->MakeCellVisible( row, 0 );
m_membersGrid->SetGridCursor( row, 0 );
m_membersGrid->EnableCellEditControl( true );
m_membersGrid->ShowCellEditControl();
/*
* Check if the clipboard contains text data.
*
* - If `clipboardHasText` is true, select the specified row in the members grid to allow our custom
* conext menu to paste the clipbaord .
* - Otherwise, enable and display the cell edit control, allowing the user to manually edit the cell.
*/
bool clipboardHasText = false;
if( wxTheClipboard->Open() )
{
if( wxTheClipboard->IsSupported( wxDF_TEXT )
|| wxTheClipboard->IsSupported( wxDF_UNICODETEXT ) )
{
clipboardHasText = true;
}
wxTheClipboard->Close();
}
if( clipboardHasText )
{
m_membersGrid->SelectRow( row );
}
else
{
m_membersGrid->EnableCellEditControl( true );
m_membersGrid->ShowCellEditControl();
}
}
@@ -459,3 +496,23 @@ void PANEL_SETUP_BUSES::OnUpdateUI( wxUpdateUIEvent& event )
}
void PANEL_SETUP_BUSES::updateAliasMembers( int aAliasIndex )
{
if( !m_aliases.empty() && m_membersGrid->GetNumberRows() > 0 && aAliasIndex >= 0
&& aAliasIndex < m_aliases.size() )
{
const std::shared_ptr<BUS_ALIAS>& alias = m_aliases[aAliasIndex];
alias->Members().clear();
for( int ii = 0; ii < m_membersGrid->GetNumberRows(); ++ii )
{
wxString memberValue = m_membersGrid->GetCellValue( ii, 0 );
if( !memberValue.empty() )
{
alias->Members().push_back( memberValue );
}
}
}
}
+10
View File
@@ -54,6 +54,16 @@ protected:
void doReloadMembersGrid();
/*
* When rows are created programmatically by pasting values from the clipboard,
* the cell change event may not be triggered. This can prevent members from
* being automatically added to the corresponding alias.
*
* To ensure that members are correctly associated with the alias,
* we manually update the members for the needed alias.
*/
void updateAliasMembers( int aAliasIndex );
private:
SCH_EDIT_FRAME* m_frame;
wxString m_membersLabelTemplate;
+35 -2
View File
@@ -346,12 +346,14 @@ PANEL_SYM_LIB_TABLE::PANEL_SYM_LIB_TABLE( DIALOG_EDIT_LIBRARY_TABLES* aParent, P
aGrid->SelectRow( 0 );
};
setupGrid( m_global_grid );
setupGrid( m_global_grid );
m_global_grid->Bind( wxEVT_GRID_CELL_LEFT_CLICK, &PANEL_SYM_LIB_TABLE::onGridCellLeftClickHandler, this );
if( m_projectTable )
{
m_project_grid->SetTable( new SYMBOL_LIB_TABLE_GRID( *m_projectTable ), true );
setupGrid( m_project_grid );
m_project_grid->Bind( wxEVT_GRID_CELL_LEFT_CLICK, &PANEL_SYM_LIB_TABLE::onGridCellLeftClickHandler, this );
}
else
{
@@ -389,9 +391,13 @@ PANEL_SYM_LIB_TABLE::~PANEL_SYM_LIB_TABLE()
// Delete the GRID_TRICKS.
// Any additional event handlers should be popped before the window is deleted.
m_global_grid->PopEventHandler( true );
m_global_grid->Unbind( wxEVT_GRID_CELL_LEFT_CLICK, &PANEL_SYM_LIB_TABLE::onGridCellLeftClickHandler, this );
if( m_project_grid )
{
m_project_grid->PopEventHandler( true );
m_project_grid->Unbind( wxEVT_GRID_CELL_LEFT_CLICK, &PANEL_SYM_LIB_TABLE::onGridCellLeftClickHandler, this );
}
m_path_subs_grid->PopEventHandler( true );
}
@@ -1072,6 +1078,33 @@ SYMBOL_LIB_TABLE_GRID* PANEL_SYM_LIB_TABLE::cur_model() const
}
void PANEL_SYM_LIB_TABLE::onGridCellLeftClickHandler( wxGridEvent& event )
{
// Get the grid object that triggered the event
wxGrid* grid = dynamic_cast<wxGrid*>( event.GetEventObject() );
// If the event object is a wxGrid, proceed with the handling
if( grid )
{
int row = event.GetRow();
int col = event.GetCol();
// Get the cell renderer for the clicked cell
wxGridCellRenderer* renderer = grid->GetCellRenderer( row, col );
// Check if the renderer is a wxGridCellBoolRenderer using dynamic_cast
if( dynamic_cast<wxGridCellBoolRenderer*>( renderer ) )
{
// Set the grid cursor to the clicked boolean cell
grid->SetGridCursor( row, col );
}
}
// Allow the default behavior to continue (toggle the bool)
event.Skip();
}
size_t PANEL_SYM_LIB_TABLE::m_pageNdx = 0;
@@ -1163,4 +1196,4 @@ void InvokeSchEditSymbolLibTable( KIWAY* aKiway, wxWindow *aParent )
aKiway->ExpressMail( FRAME_SCH, MAIL_RELOAD_LIB, payload );
aKiway->ExpressMail( FRAME_SCH_SYMBOL_EDITOR, MAIL_RELOAD_LIB, payload );
aKiway->ExpressMail( FRAME_SCH_VIEWER, MAIL_RELOAD_LIB, payload );
}
}
+1
View File
@@ -58,6 +58,7 @@ private:
void onSizeGrid( wxSizeEvent& event ) override;
void adjustPathSubsGridColumns( int aWidth );
void onConvertLegacyLibraries( wxCommandEvent& event ) override;
void onGridCellLeftClickHandler( wxGridEvent& event );
bool TransferDataFromWindow() override;
+34 -1
View File
@@ -22,6 +22,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <wx/msgdlg.h>
#include <pgm_base.h>
#include <settings/settings_manager.h>
#include <eeschema_settings.h>
@@ -186,10 +188,41 @@ bool PANEL_TEMPLATE_FIELDNAMES::TransferDataFromWindow()
m_templateMgr->DeleteAllFieldNameTemplates( m_global );
for( const TEMPLATE_FIELDNAME& field : m_fields )
for( TEMPLATE_FIELDNAME& field : m_fields )
{
if( !field.m_Name.IsEmpty() )
{
wxString trimmedName = field.m_Name;
trimmedName.Trim();
trimmedName.Trim( false );
// Check if the field name contains leading and/or trailing white space.
if( field.m_Name != trimmedName )
{
wxString msg;
msg.Printf( _( "The field name \"%s\" contains trailing and/or leading white"
"space." ), field.m_Name );
wxMessageDialog dlg( this, msg, _( "Warning" ),
wxOK | wxCANCEL | wxCENTER | wxICON_WARNING );
dlg.SetExtendedMessage( _( "This may result in what appears to be duplicate field "
"names but are actually unique names differing only by "
"white space characters. Removing the white space "
"characters will have no effect on existing symbol "
"field names." ) );
dlg.SetOKCancelLabels( wxMessageDialog::ButtonLabel( _( "Remove White Space" ) ),
wxMessageDialog::ButtonLabel( _( "Keep White Space" ) ) );
if( dlg.ShowModal() == wxID_OK )
field.m_Name = trimmedName;
}
m_templateMgr->AddTemplateFieldName( field, m_global );
}
}
if( m_global )
+12 -3
View File
@@ -533,6 +533,13 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
SCH_COMMIT dummy( this );
RecalculateConnections( &dummy, GLOBAL_CLEANUP );
if( schematic.HasSymbolFieldNamesWithWhiteSpace() )
{
m_infoBar->QueueShowMessage( _( "This schematic contains symbols that have leading "
"and/or trailing white space field names." ),
wxICON_WARNING );
}
}
// Load any exclusions from the project file
@@ -1248,7 +1255,9 @@ bool SCH_EDIT_FRAME::SaveProject( bool aSaveAs )
wxCHECK2( screen, continue );
sheets.emplace_back( std::make_pair( screen->GetUuid(), sheet->GetName() ) );
// For the root sheet we use the canonical name ( "Root" ) because its name
// cannot be modified by the user
sheets.emplace_back( std::make_pair( screen->GetUuid(), wxT( "Root" ) ) );
}
else
{
@@ -1404,8 +1413,8 @@ bool SCH_EDIT_FRAME::importFile( const wxString& aFileName, int aFileType,
pi->SetProgressReporter( &progressReporter );
SCH_SHEET* loadedSheet =
pi->LoadSchematicFile( aFileName, &Schematic(), nullptr, aProperties );
SCH_SHEET* loadedSheet = pi->LoadSchematicFile( aFileName, &Schematic(), nullptr,
aProperties );
if( loadedSheet )
{
+3 -1
View File
@@ -136,9 +136,11 @@ void ConvertImageToLibShapes( LIB_SYMBOL* aSymbol, int unit, wxImage img, VECTOR
shape->Offset( offset );
aSymbol->AddDrawItem( shape.release() );
aSymbol->AddDrawItem( shape.release(), false );
}
}
aSymbol->GetDrawItems().sort();
}
-1
View File
@@ -139,5 +139,4 @@ private:
const TRANSFORM& aTransform, bool aDimmed ) override;
};
#endif // LIB_SHAPE_H
+2 -2
View File
@@ -372,8 +372,8 @@ void SCH_EDIT_FRAME::onNetNavigatorSelection( wxTreeEvent& aEvent )
if( GetCurrentSheet() != itemData->GetSheetPath() )
{
Schematic().SetCurrentSheet( itemData->GetSheetPath() );
DisplayCurrentSheet();
GetToolManager()->RunAction<SCH_SHEET_PATH*>( EE_ACTIONS::changeSheet,
&itemData->GetSheetPath() );
}
// Do not focus on item when a sheet tree node is selected.
@@ -3,7 +3,7 @@
*
* Copyright (C) 1992-2018 jp.charras at wanadoo.fr
* Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2023, 2024 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -23,6 +23,9 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <algorithm>
#include <vector>
#include <confirm.h>
#include <refdes_utils.h>
@@ -68,8 +71,23 @@ bool NETLIST_EXPORTER_ORCADPCB2::WriteNetlist( const wxString& aOutFileName,
{
SCH_SHEET_PATH sheet = sheetList[i];
// Process symbol attributes
// The rtree returns items in a non-deterministic order (platform-dependent)
// Therefore we need to sort them before outputting to ensure file stability for version
// control and QA comparisons
std::vector<EDA_ITEM*> sheetItems;
for( EDA_ITEM* item : sheet.LastScreen()->Items().OfType( SCH_SYMBOL_T ) )
sheetItems.push_back( item );
auto pred = []( const EDA_ITEM* item1, const EDA_ITEM* item2 )
{
return item1->m_Uuid < item2->m_Uuid;
};
std::sort( sheetItems.begin(), sheetItems.end(), pred );
// Process symbol attributes
for( EDA_ITEM* item : sheetItems )
{
SCH_SYMBOL* symbol = findNextSymbol( item, &sheet );
+5 -6
View File
@@ -769,8 +769,9 @@ void SCH_EDIT_FRAME::AddCopyForRepeatItem( const SCH_ITEM* aItem )
{
std::unique_ptr<SCH_ITEM> repeatItem( static_cast<SCH_ITEM*>( aItem->Duplicate() ) );
// Clone() preserves the flags, we want 'em cleared.
// Clone() preserves the flags & parent, we want 'em cleared.
repeatItem->ClearFlags();
repeatItem->SetParent( nullptr );
m_items_to_repeat.emplace_back( std::move( repeatItem ) );
}
@@ -1110,6 +1111,7 @@ void SCH_EDIT_FRAME::OnUpdatePCB( wxCommandEvent& event )
}
KIWAY_PLAYER* frame = Kiway().Player( FRAME_PCB_EDITOR, false );
wxEventBlocker blocker( this );
if( !frame )
{
@@ -1337,6 +1339,7 @@ void SCH_EDIT_FRAME::OnOpenPcbnew( wxCommandEvent& event )
}
else
{
wxEventBlocker blocker(this);
KIWAY_PLAYER* frame = Kiway().Player( FRAME_PCB_EDITOR, false );
if( !frame )
@@ -1678,9 +1681,7 @@ void SCH_EDIT_FRAME::RecalculateConnections( SCH_COMMIT* aCommit, SCH_CLEANUP_FL
if( !aCommit )
aCommit = &localCommit;
#ifdef PROFILE
PROF_TIMER timer;
#endif
// Ensure schematic graph is accurate
if( aCleanupFlags == LOCAL_CLEANUP )
@@ -1693,10 +1694,8 @@ void SCH_EDIT_FRAME::RecalculateConnections( SCH_COMMIT* aCommit, SCH_CLEANUP_FL
SchematicCleanUp( aCommit, sheet.LastScreen() );
}
#ifdef PROFILE
timer.Stop();
wxLogTrace( "CONN_PROFILE", "SchematicCleanUp() %0.4f ms", timer.msecs() );
#endif
if( settings.m_IntersheetRefsShow )
RecomputeIntersheetRefs();
@@ -1713,7 +1712,7 @@ void SCH_EDIT_FRAME::RecalculateConnections( SCH_COMMIT* aCommit, SCH_CLEANUP_FL
};
if( !ADVANCED_CFG::GetCfg().m_IncrementalConnectivity || aCleanupFlags == GLOBAL_CLEANUP
|| m_undoList.m_CommandsList.empty() )
|| m_undoList.m_CommandsList.empty()|| Schematic().ConnectionGraph()->IsMinor() )
{
Schematic().ConnectionGraph()->Recalculate( list, true, &changeHandler );
}
@@ -92,6 +92,9 @@ SCH_SHEET* SCH_IO_CADSTAR_ARCHIVE::LoadSchematicFile( const wxString& aFi
SCH_SCREEN* screen = new SCH_SCREEN( aSchematic );
screen->SetFileName( aFileName );
rootSheet->SetScreen( screen );
// Virtual root sheet UUID must be the same as the schematic file UUID.
const_cast<KIID&>( rootSheet->m_Uuid ) = screen->GetUuid();
}
CADSTAR_SCH_ARCHIVE_LOADER csaLoader( aFileName, m_reporter, m_progressReporter );
+10 -10
View File
@@ -343,19 +343,19 @@ void SCH_IO_DATABASE::connect()
{
std::set<std::string> columns;
columns.insert( tableIter.key_col );
columns.insert( tableIter.footprints_col );
columns.insert( tableIter.symbols_col );
columns.insert( boost::to_lower_copy( tableIter.key_col ) );
columns.insert( boost::to_lower_copy( tableIter.footprints_col ) );
columns.insert( boost::to_lower_copy( tableIter.symbols_col ) );
columns.insert( tableIter.properties.description );
columns.insert( tableIter.properties.footprint_filters );
columns.insert( tableIter.properties.keywords );
columns.insert( tableIter.properties.exclude_from_sim );
columns.insert( tableIter.properties.exclude_from_bom );
columns.insert( tableIter.properties.exclude_from_board );
columns.insert( boost::to_lower_copy( tableIter.properties.description ) );
columns.insert( boost::to_lower_copy( tableIter.properties.footprint_filters ) );
columns.insert( boost::to_lower_copy( tableIter.properties.keywords ) );
columns.insert( boost::to_lower_copy( tableIter.properties.exclude_from_sim ) );
columns.insert( boost::to_lower_copy( tableIter.properties.exclude_from_bom ) );
columns.insert( boost::to_lower_copy( tableIter.properties.exclude_from_board ) );
for( const DATABASE_FIELD_MAPPING& field : tableIter.fields )
columns.insert( field.column );
columns.insert( boost::to_lower_copy( field.column ) );
m_conn->CacheTableInfo( tableIter.table, columns );
}
+1 -1
View File
@@ -2903,7 +2903,7 @@ bool SCH_IO_EAGLE::checkHeader( const wxString& aFileName ) const
wxTextInputStream text( input );
for( int i = 0; i < 4; i++ )
for( int i = 0; i < 8; i++ )
{
if( input.Eof() )
return false;
@@ -944,16 +944,16 @@ LIB_SYMBOL* SCH_EASYEDA_PARSER::ParseSymbol( const VECTOR2D& aOrigi
std::optional<wxString> valOpt;
wxString symbolName = wxS( "Unknown" );
if( valOpt = get_opt( aParams, wxS( "name" ) ) )
if( ( valOpt = get_opt( aParams, wxS( "name" ) ) ) )
symbolName = *valOpt;
else if( valOpt = get_opt( aParams, wxS( "spiceSymbolName" ) ) )
else if( ( valOpt = get_opt( aParams, wxS( "spiceSymbolName" ) ) ) )
symbolName = *valOpt;
wxString symbolPrefix;
if( valOpt = get_opt( aParams, wxS( "pre" ) ) )
if( ( valOpt = get_opt( aParams, wxS( "pre" ) ) ) )
symbolPrefix = *valOpt;
else if( valOpt = get_opt( aParams, wxS( "spicePre" ) ) )
else if( ( valOpt = get_opt( aParams, wxS( "spicePre" ) ) ) )
symbolPrefix = *valOpt;
LIB_ID libId = EasyEdaToKiCadLibID( wxEmptyString, symbolName );
@@ -971,7 +971,7 @@ LIB_SYMBOL* SCH_EASYEDA_PARSER::ParseSymbol( const VECTOR2D& aOrigi
if( srcName == wxS( "Datasheet" ) )
srcName = wxS( "link" );
if( valOpt = get_opt( aParams, srcName ) )
if( ( valOpt = get_opt( aParams, srcName ) ) )
{
if( valOpt->empty() )
continue;
@@ -640,6 +640,9 @@ SCH_SHEET* SCH_IO_EASYEDA::LoadSchematicFile( const wxString& aFileName, SCHEMAT
screen->SetFileName( aFileName );
rootSheet->SetScreen( screen );
// Virtual root sheet UUID must be the same as the schematic file UUID.
const_cast<KIID&>( rootSheet->m_Uuid ) = screen->GetUuid();
}
SYMBOL_LIB_TABLE* libTable = PROJECT_SCH::SchSymbolLibTable( &aSchematic->Prj() );
@@ -505,6 +505,32 @@ SCH_EASYEDAPRO_PARSER::ParseSymbol( const std::vector<nlohmann::json>& aLines,
ksymbol->AddDrawItem( shape.release() );
}
else if( type == wxS( "BEZIER" ) )
{
std::vector<double> points = line.at( 2 );
wxString styleStr = line.at( 3 );
std::unique_ptr<LIB_SHAPE> shape =
std::make_unique<LIB_SHAPE>( ksymbol, SHAPE_T::BEZIER );
for( size_t i = 1; i < points.size(); i += 2 )
{
VECTOR2I pt = ScalePosSym( VECTOR2D( points[i - 1], points[i] ) );
switch( i )
{
case 1: shape->SetStart( pt ); break;
case 3: shape->SetBezierC1( pt ); break;
case 5: shape->SetBezierC2( pt ); break;
case 7: shape->SetEnd( pt ); break;
}
}
shape->SetUnit( currentUnit );
ApplyLineStyle( lineStyles, shape, styleStr );
ksymbol->AddDrawItem( shape.release() );
}
else if( type == wxS( "POLY" ) )
{
std::vector<double> points = line.at( 2 );
@@ -1148,8 +1174,8 @@ void SCH_EASYEDAPRO_PARSER::ParseSchematic( SCHEMATIC* aSchematic, SCH_SHEET* aR
if( !deviceAttr )
continue;
std::map<wxString, wxString> compAttrs =
aProject.at( "devices" ).at( deviceAttr->value ).at( "attributes" );
std::map<wxString, wxString> compAttrs = EASYEDAPRO::AnyMapToStringMap(
aProject.at( "devices" ).at( deviceAttr->value ).at( "attributes" ) );
wxString symbolId;
@@ -1210,39 +1236,60 @@ void SCH_EASYEDAPRO_PARSER::ParseSchematic( SCHEMATIC* aSchematic, SCH_SHEET* aR
{
auto nameAttr = get_opt( attributes, "Name" );
wxString netName;
if( nameAttr && !nameAttr->value.IsEmpty() )
netName = nameAttr->value;
else
netName = compAttrs.at( "Name" );
std::unique_ptr<SCH_GLOBALLABEL> label = std::make_unique<SCH_GLOBALLABEL>(
ScalePos( component->position ), netName );
std::vector<SCH_PIN*> pins = schSym->GetPins( &aSchematic->CurrentSheet() );
if( pins.size() > 0 )
{
switch( pins[0]->GetType() )
{
case ELECTRICAL_PINTYPE::PT_INPUT:
label->SetShape( LABEL_FLAG_SHAPE::L_INPUT );
break;
case ELECTRICAL_PINTYPE::PT_OUTPUT:
label->SetShape( LABEL_FLAG_SHAPE::L_OUTPUT );
break;
case ELECTRICAL_PINTYPE::PT_BIDI:
label->SetShape( LABEL_FLAG_SHAPE::L_BIDI );
break;
default: break;
}
}
BOX2I bbox = schSym->GetBodyAndPinsBoundingBox();
bbox.Offset( -schSym->GetPosition() );
VECTOR2I bboxCenter = bbox.GetCenter();
SPIN_STYLE spin = SPIN_STYLE::LEFT;
if( std::abs( bboxCenter.x ) >= std::abs( bboxCenter.y ) )
{
if( bboxCenter.x >= 0 )
spin = SPIN_STYLE::RIGHT;
else
spin = SPIN_STYLE::LEFT;
}
else
{
if( bboxCenter.y >= 0 )
spin = SPIN_STYLE::BOTTOM;
else
spin = SPIN_STYLE::UP;
}
label->SetSpinStyle( spin );
if( nameAttr )
{
std::unique_ptr<SCH_GLOBALLABEL> label = std::make_unique<SCH_GLOBALLABEL>(
ScalePos( component->position ), nameAttr->value );
SPIN_STYLE spin = SPIN_STYLE::LEFT;
if( esymInfo.symbolAttr )
{
wxString symStr = esymInfo.symbolAttr->value;
if( symStr == wxS( "Netport-IN" ) )
{
spin = SPIN_STYLE::LEFT;
label->SetShape( LABEL_FLAG_SHAPE::L_INPUT );
}
if( symStr == wxS( "Netport-OUT" ) )
{
spin = SPIN_STYLE::RIGHT;
label->SetShape( LABEL_FLAG_SHAPE::L_OUTPUT );
}
if( symStr == wxS( "Netport-BI" ) )
{
spin = SPIN_STYLE::RIGHT;
label->SetShape( LABEL_FLAG_SHAPE::L_BIDI );
}
}
for( double i = component->rotation; i > 0; i -= 90 )
spin = spin.RotateCCW();
label->SetSpinStyle( spin );
nlohmann::json style = fontStyles[nameAttr->fontStyle];
if( !style.is_null() && style.at( 5 ).is_number() )
@@ -1250,10 +1297,10 @@ void SCH_EASYEDAPRO_PARSER::ParseSchematic( SCHEMATIC* aSchematic, SCH_SHEET* aR
double size = style.at( 5 ).get<double>() * 0.5;
label->SetTextSize( VECTOR2I( ScaleSize( size ), ScaleSize( size ) ) );
}
createdItems.push_back( std::move( label ) );
}
createdItems.push_back( std::move( label ) );
continue;
}
else
@@ -1285,6 +1332,12 @@ void SCH_EASYEDAPRO_PARSER::ParseSchematic( SCHEMATIC* aSchematic, SCH_SHEET* aR
auto nameAttr = get_opt( attributes, "Name" );
auto valueAttr = get_opt( attributes, "Value" );
if( valueAttr && valueAttr->value.empty() )
valueAttr->value = get_def( compAttrs, "Value", wxString() );
if( nameAttr && nameAttr->value.empty() )
nameAttr->value = get_def( compAttrs, "Name", wxString() );
std::optional<EASYEDAPRO::SCH_ATTR> targetValueAttr;
if( valueAttr && !valueAttr->value.empty() && valueAttr->valVisible )
@@ -1412,7 +1465,7 @@ void SCH_EASYEDAPRO_PARSER::ParseSchematic( SCHEMATIC* aSchematic, SCH_SHEET* aR
if( netAttr )
{
if( !netAttr->valVisible )
if( !netAttr->valVisible || netAttr->value.IsEmpty() )
continue;
VECTOR2I kpos = ScalePos( *netAttr->position );

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