Compare commits

...

193 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
236 changed files with 68632 additions and 54571 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() );
}
}
}
+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 );
@@ -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 );
}
}
+7 -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" ) );
@@ -606,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 );
@@ -642,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();
@@ -673,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
+1 -1
View File
@@ -221,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 )
{
+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.7" )
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)
+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() )
+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;
}
+47
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 );
-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 ) )
+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)
+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 )
{
+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 )
+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
@@ -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() );
+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 -1
View File
@@ -434,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 );
+3 -1
View File
@@ -1255,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
{
-1
View File
@@ -139,5 +139,4 @@ private:
const TRANSFORM& aTransform, bool aDimmed ) override;
};
#endif // LIB_SHAPE_H
@@ -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 );
+3 -5
View File
@@ -1111,6 +1111,7 @@ void SCH_EDIT_FRAME::OnUpdatePCB( wxCommandEvent& event )
}
KIWAY_PLAYER* frame = Kiway().Player( FRAME_PCB_EDITOR, false );
wxEventBlocker blocker( this );
if( !frame )
{
@@ -1338,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 )
@@ -1679,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 )
@@ -1694,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();
@@ -1714,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() );
@@ -455,6 +455,9 @@ SCH_SHEET* SCH_IO_EASYEDAPRO::LoadSchematicFile( const wxString& aFileName,
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() );
@@ -1159,11 +1159,16 @@ LIB_PIN* SCH_IO_KICAD_LEGACY_LIB_CACHE::loadPin( std::unique_ptr<LIB_SYMBOL>& aS
pos += tmp.size() + 1;
PIN_ORIENTATION orientation = PIN_ORIENTATION::PIN_RIGHT;
std::optional<PIN_ORIENTATION> optVal = magic_enum::enum_cast<PIN_ORIENTATION>( tmp[0] );
PIN_ORIENTATION orientation;
if( optVal.has_value() )
orientation = optVal.value();
switch( static_cast<char>( tmp[0] ) )
{
case 'U': orientation = PIN_ORIENTATION::PIN_UP; break;
case 'D': orientation = PIN_ORIENTATION::PIN_DOWN; break;
case 'L': orientation = PIN_ORIENTATION::PIN_LEFT; break;
case 'R': /* fall-through */
default: orientation = PIN_ORIENTATION::PIN_RIGHT; break;
}
tmp = tokens.GetNextToken();
@@ -1331,7 +1331,7 @@ void SCH_IO_KICAD_SEXPR::saveText( SCH_TEXT* aText, int aNestLevel )
EDA_UNIT_UTILS::FormatAngle( angle ).c_str() );
}
if( aText->GetFieldsAutoplaced() != FIELDS_AUTOPLACED_NO )
if( label && !label->GetFields().empty() && label->GetFieldsAutoplaced() != FIELDS_AUTOPLACED_NO )
m_out->Print( 0, " (fields_autoplaced yes)" );
m_out->Print( 0, "\n" );
@@ -309,29 +309,42 @@ void formatPoly( OUTPUTFORMATTER* aFormatter, int aNestLevel, EDA_SHAPE* aPolyLi
{
int newLine = 0;
int lineCount = 1;
aFormatter->Print( aNestLevel, "(polyline%s\n",
aIsPrivate ? " private" : "" );
aFormatter->Print( aNestLevel + 1, "(pts" );
for( const VECTOR2I& pt : aPolyLine->GetPolyShape().Outline( 0 ).CPoints() )
{
if( newLine == 4 || !ADVANCED_CFG::GetCfg().m_CompactSave )
{
aFormatter->Print( 0, "\n" );
aFormatter->Print( aNestLevel + 2, "(xy %s %s)",
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, pt.x ).c_str(),
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, pt.y ).c_str() );
newLine = 0;
lineCount += 1;
}
else
{
aFormatter->Print( 0, " (xy %s %s)",
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, pt.x ).c_str(),
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, pt.y ).c_str() );
}
const SHAPE_POLY_SET& polySet = aPolyLine->GetPolyShape();
newLine += 1;
if( polySet.OutlineCount() == 0 )
{
// If we've managed to get a polyline with no points, that's probably a bad thing,
// but at least don't dereference it and crash.
wxFAIL_MSG( "Polyline has no outline" );
}
else
{
for( const VECTOR2I& pt : polySet.Outline( 0 ).CPoints() )
{
if( newLine == 4 || !ADVANCED_CFG::GetCfg().m_CompactSave )
{
aFormatter->Print( 0, "\n" );
aFormatter->Print( aNestLevel + 2, "(xy %s %s)",
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, pt.x ).c_str(),
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, pt.y ).c_str() );
newLine = 0;
lineCount += 1;
}
else
{
aFormatter->Print( 0, " (xy %s %s)",
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, pt.x ).c_str(),
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, pt.y ).c_str() );
}
newLine += 1;
}
}
if( lineCount == 1 )
@@ -3578,6 +3578,16 @@ SCH_BUS_WIRE_ENTRY* SCH_IO_KICAD_SEXPR_PARSER::parseBusEntry()
}
void fixupSchFillMode( SCH_SHAPE* aShape )
{
if( aShape->GetFillMode() == FILL_T::FILLED_SHAPE )
{
aShape->SetFillColor( aShape->GetStroke().GetColor() );
aShape->SetFillMode( FILL_T::FILLED_WITH_COLOR );
}
}
SCH_SHAPE* SCH_IO_KICAD_SEXPR_PARSER::parseSchPolyLine()
{
T token;
@@ -3627,6 +3637,7 @@ SCH_SHAPE* SCH_IO_KICAD_SEXPR_PARSER::parseSchPolyLine()
parseFill( fill );
polyline->SetFillMode( fill.m_FillType );
polyline->SetFillColor( fill.m_Color );
fixupSchFillMode( polyline.get() );
break;
case T_uuid:
@@ -3759,6 +3770,7 @@ SCH_SHAPE* SCH_IO_KICAD_SEXPR_PARSER::parseSchArc()
parseFill( fill );
arc->SetFillMode( fill.m_FillType );
arc->SetFillColor( fill.m_Color );
fixupSchFillMode( arc.get() );
break;
case T_uuid:
@@ -3818,6 +3830,7 @@ SCH_SHAPE* SCH_IO_KICAD_SEXPR_PARSER::parseSchCircle()
parseFill( fill );
circle->SetFillMode( fill.m_FillType );
circle->SetFillColor( fill.m_Color );
fixupSchFillMode( circle.get() );
break;
case T_uuid:
@@ -3876,6 +3889,7 @@ SCH_SHAPE* SCH_IO_KICAD_SEXPR_PARSER::parseSchRectangle()
parseFill( fill );
rectangle->SetFillMode( fill.m_FillType );
rectangle->SetFillColor( fill.m_Color );
fixupSchFillMode( rectangle.get() );
break;
case T_uuid:
@@ -3949,6 +3963,7 @@ SCH_SHAPE* SCH_IO_KICAD_SEXPR_PARSER::parseSchBezier()
parseFill( fill );
bezier->SetFillMode( fill.m_FillType );
bezier->SetFillColor( fill.m_Color );
fixupSchFillMode( bezier.get() );
break;
case T_uuid:
@@ -4201,6 +4216,7 @@ SCH_TEXTBOX* SCH_IO_KICAD_SEXPR_PARSER::parseSchTextBox()
parseFill( fill );
textBox->SetFillMode( fill.m_FillType );
textBox->SetFillColor( fill.m_Color );
fixupSchFillMode( textBox.get() );
break;
case T_effects:
@@ -65,6 +65,9 @@ SCH_SHEET* SCH_IO_LTSPICE::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() );
+6 -1
View File
@@ -52,7 +52,7 @@
/* They are not inline because this creates problems with gcc at linking time in debug mode */
SCH_ITEM::SCH_ITEM( EDA_ITEM* aParent, KICAD_T aType ) :
EDA_ITEM( aParent, aType )
EDA_ITEM( aParent, aType, true, false )
{
m_layer = LAYER_WIRE; // It's only a default, in fact
m_fieldsAutoplaced = FIELDS_AUTOPLACED_NO;
@@ -123,6 +123,11 @@ SCH_ITEM* SCH_ITEM::Duplicate( bool doClone ) const
SCHEMATIC* SCH_ITEM::Schematic() const
{
if( !SCHEMATIC::m_IsSchematicExists )
{
return nullptr;
}
EDA_ITEM* parent = GetParent();
while( parent )
+6 -4
View File
@@ -1313,9 +1313,10 @@ void SCH_LABEL_BASE::Plot( PLOTTER* aPlotter, bool aBackground,
int layer = ( connection && connection->IsBus() ) ? LAYER_BUS : m_layer;
COLOR4D color = settings->GetLayerColor( layer );
int penWidth = GetEffectiveTextPenWidth( settings->GetDefaultPenWidth() );
COLOR4D labelColor = GetLabelColor();
if( aPlotter->GetColorMode() && GetTextColor() != COLOR4D::UNSPECIFIED )
color = GetTextColor();
if( aPlotter->GetColorMode() && labelColor != COLOR4D::UNSPECIFIED )
color = labelColor;
penWidth = std::max( penWidth, settings->GetMinPenWidth() );
aPlotter->SetCurrentLineWidth( penWidth );
@@ -1412,9 +1413,10 @@ void SCH_LABEL_BASE::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aO
bool blackAndWhiteMode = GetGRForceBlackPenState();
int penWidth = std::max( GetPenWidth(), aSettings->GetDefaultPenWidth() );
VECTOR2I text_offset = aOffset + GetSchematicTextOffset( aSettings );
COLOR4D labelColor = GetLabelColor();
if( !blackAndWhiteMode && GetTextColor() != COLOR4D::UNSPECIFIED )
color = GetTextColor();
if( !blackAndWhiteMode && labelColor != COLOR4D::UNSPECIFIED )
color = labelColor;
EDA_TEXT::Print( aSettings, text_offset, color );
-41
View File
@@ -101,47 +101,6 @@ wxString SCH_LINE::GetFriendlyName() const
}
wxString SCH_LINE::GetNetname( const SCH_SHEET_PATH& aSheet )
{
std::list<const SCH_LINE *> checkedLines;
checkedLines.push_back(this);
return FindWireSegmentNetNameRecursive( this, checkedLines, aSheet );
}
wxString SCH_LINE::FindWireSegmentNetNameRecursive( SCH_LINE *line,
std::list<const SCH_LINE *> &checkedLines,
const SCH_SHEET_PATH& aSheet ) const
{
for ( auto connected : line->ConnectedItems( aSheet ) )
{
if( connected->Type() == SCH_LINE_T )
{
if( std::find(checkedLines.begin(), checkedLines.end(),
connected ) == checkedLines.end() )
{
SCH_LINE* connectedLine = static_cast<SCH_LINE*>( connected );
checkedLines.push_back( connectedLine );
wxString netName = FindWireSegmentNetNameRecursive( connectedLine, checkedLines,
aSheet );
if( !netName.IsEmpty() )
return netName;
}
}
else if( connected->Type() == SCH_LABEL_T
|| connected->Type() == SCH_GLOBAL_LABEL_T
|| connected->Type() == SCH_DIRECTIVE_LABEL_T)
{
return static_cast<SCH_TEXT*>( connected )->GetText();
}
}
return "";
}
EDA_ITEM* SCH_LINE::Clone() const
{
return new SCH_LINE( *this );
-8
View File
@@ -63,14 +63,6 @@ public:
wxString GetFriendlyName() const override;
/**
* @brief This function travel though all the connected wire segments
* to look for connected labels.
* @param aSheet - the sheet where the current wire segment is located
* @return returns the name of the wire if connected labels found, otherwise empty string
*/
wxString GetNetname(const SCH_SHEET_PATH &aSheet);
bool IsType( const std::vector<KICAD_T>& aScanTypes ) const override
{
if( SCH_ITEM::IsType( aScanTypes ) )
+15 -8
View File
@@ -126,7 +126,8 @@ wxString SCH_PIN::GetShownNumber() const
ELECTRICAL_PINTYPE SCH_PIN::GetType() const
{
wxCHECK( m_libPin, ELECTRICAL_PINTYPE::PT_NC );
if( !m_libPin )
return ELECTRICAL_PINTYPE::PT_NC;
if( !m_alt.IsEmpty() )
return m_libPin->GetAlt( m_alt ).m_Type;
@@ -137,7 +138,8 @@ ELECTRICAL_PINTYPE SCH_PIN::GetType() const
GRAPHIC_PINSHAPE SCH_PIN::GetShape() const
{
wxCHECK( m_libPin, GRAPHIC_PINSHAPE::LINE );
if( !m_libPin )
return GRAPHIC_PINSHAPE::LINE;
if( !m_alt.IsEmpty() )
return m_libPin->GetAlt( m_alt ).m_Shape;
@@ -148,7 +150,8 @@ GRAPHIC_PINSHAPE SCH_PIN::GetShape() const
PIN_ORIENTATION SCH_PIN::GetOrientation() const
{
wxCHECK( m_libPin, PIN_ORIENTATION::PIN_RIGHT );
if( !m_libPin )
return PIN_ORIENTATION::PIN_RIGHT;
return m_libPin->GetOrientation();
}
@@ -156,7 +159,8 @@ PIN_ORIENTATION SCH_PIN::GetOrientation() const
int SCH_PIN::GetLength() const
{
wxCHECK( m_libPin, 0 );
if( !m_libPin )
return 0;
return m_libPin->GetLength();
}
@@ -301,7 +305,8 @@ bool SCH_PIN::IsStacked( const SCH_PIN* aPin ) const
bool SCH_PIN::IsGlobalPower() const
{
wxCHECK( m_libPin, false );
if( !m_libPin )
return false;
return m_libPin->IsGlobalPower();
}
@@ -425,8 +430,6 @@ const BOX2I SCH_PIN::GetBoundingBox( bool aIncludeInvisiblePins, bool aIncludeNa
if( m_libPin )
r = m_libPin->GetBoundingBox( aIncludeInvisiblePins, aIncludeNameAndNumber,
aIncludeElectricalType );
else
wxFAIL;
r.RevertYAxis();
@@ -491,7 +494,8 @@ bool SCH_PIN::HasConnectivityChanges( const SCH_ITEM* aItem,
bool SCH_PIN::ConnectionPropagatesTo( const EDA_ITEM* aItem ) const
{
wxCHECK( m_libPin, false );
if( !m_libPin )
return false;
// Reciprocal checking is done in CONNECTION_GRAPH anyway
return !( m_libPin->GetType() == ELECTRICAL_PINTYPE::PT_NC );
@@ -511,6 +515,9 @@ bool SCH_PIN::operator==( const SCH_ITEM& aOther ) const
if( m_position != other.m_position )
return false;
if( !m_libPin )
return false;
return m_libPin == other.m_libPin;
}
+59
View File
@@ -34,6 +34,8 @@
#include <sch_shape.h>
#include "plotters/plotter.h"
// This is a horribly fix for a link issue
extern template class wxAnyValueTypeImpl<FILL_T>;
SCH_SHAPE::SCH_SHAPE( SHAPE_T aShape, int aLineWidth, FILL_T aFillType, KICAD_T aType ) :
SCH_ITEM( nullptr, aType ),
@@ -66,6 +68,17 @@ void SCH_SHAPE::SetStroke( const STROKE_PARAMS& aStroke )
}
void SCH_SHAPE::SetFilled( bool aFilled )
{
if( !aFilled )
m_fill = FILL_T::NO_FILL;
else if( GetParent()->IsType( { SCH_SYMBOL_T, LIB_SYMBOL_T } ) )
m_fill = FILL_T::FILLED_SHAPE;
else
m_fill = FILL_T::FILLED_WITH_COLOR;
}
void SCH_SHAPE::Move( const VECTOR2I& aOffset )
{
move( aOffset );
@@ -550,9 +563,55 @@ static struct SCH_SHAPE_DESC
return false;
};
auto isSymbolItem =
[]( INSPECTABLE* aItem ) -> bool
{
if( SCH_SHAPE* shape = dynamic_cast<SCH_SHAPE*>( aItem ) )
return shape->GetLayer() == LAYER_DEVICE;
return false;
};
auto isSchematicItem =
[]( INSPECTABLE* aItem ) -> bool
{
if( SCH_SHAPE* shape = dynamic_cast<SCH_SHAPE*>( aItem ) )
return shape->GetLayer() != LAYER_DEVICE;
return false;
};
auto isFillColorEditable =
[]( INSPECTABLE* aItem ) -> bool
{
if( SCH_SHAPE* shape = dynamic_cast<SCH_SHAPE*>( aItem ) )
{
if( shape->GetParent()->IsType( { SCH_SYMBOL_T, LIB_SYMBOL_T } ) )
return shape->GetFillMode() == FILL_T::FILLED_WITH_COLOR;
else
return shape->IsFilled();
}
return true;
};
propMgr.OverrideAvailability( TYPE_HASH( SCH_SHAPE ), TYPE_HASH( SCH_ITEM ),
_HKI( "Position X" ), isPolygon );
propMgr.OverrideAvailability( TYPE_HASH( SCH_SHAPE ), TYPE_HASH( SCH_ITEM ),
_HKI( "Position Y" ), isPolygon );
propMgr.OverrideAvailability( TYPE_HASH( SCH_SHAPE ), TYPE_HASH( EDA_SHAPE ),
_HKI( "Filled" ), isSchematicItem );
propMgr.OverrideWriteability( TYPE_HASH( SCH_SHAPE ), TYPE_HASH( EDA_SHAPE ),
_HKI( "Fill Color" ), isFillColorEditable );
void ( SCH_SHAPE::*fillModeSetter )( FILL_T ) = &SCH_SHAPE::SetFillMode;
FILL_T ( SCH_SHAPE::*fillModeGetter )() const = &SCH_SHAPE::GetFillMode;
propMgr.AddProperty( new PROPERTY_ENUM<SCH_SHAPE, FILL_T>( _HKI( "Fill" ),
fillModeSetter, fillModeGetter ),
_HKI( "Shape Properties" ) )
.SetAvailableFunc( isSymbolItem );
}
} _SCH_SHAPE_DESC;
+2
View File
@@ -72,6 +72,8 @@ public:
return m_stroke.GetLineStyle();
}
void SetFilled( bool aFilled ) override;
const BOX2I GetBoundingBox() const override { return getBoundingBox(); }
VECTOR2I GetPosition() const override { return getPosition(); }
+4
View File
@@ -656,9 +656,13 @@ void SCH_SHEET_PATH::CheckForMissingSymbolInstances( const wxString& aProjectNam
{
symbolInstance.m_Reference =
symbol->GetField( REFERENCE_FIELD )->GetShownText( this, true );
symbolInstance.m_Unit = symbol->GetUnit();
}
else
{
// When schematics are shared, we cannot know which instance the current symbol
// reference field and unit belong to. In this case, we clear the reference
// annotation and set the unit to 1.
symbolInstance.m_Reference = UTIL::GetRefDesUnannotated( symbol->GetPrefix() );
}
+6 -5
View File
@@ -2177,12 +2177,12 @@ bool SCH_SYMBOL::UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemListB
}
VECTOR2I SCH_SYMBOL::GetPinPhysicalPosition( const LIB_PIN* Pin ) const
VECTOR2I SCH_SYMBOL::GetPinPhysicalPosition( const LIB_PIN* aPin ) const
{
wxCHECK_MSG( Pin != nullptr && Pin->Type() == LIB_PIN_T, VECTOR2I( 0, 0 ),
wxT( "Cannot get physical position of pin." ) );
if( ( aPin == nullptr ) || ( aPin->Type() != LIB_PIN_T ) )
return VECTOR2I( 0, 0 );
return m_transform.TransformCoordinate( Pin->GetPosition() ) + m_pos;
return m_transform.TransformCoordinate( aPin->GetPosition() ) + m_pos;
}
@@ -2699,7 +2699,8 @@ bool SCH_SYMBOL::IsSymbolLikePowerGlobalLabel() const
bool SCH_SYMBOL::IsPower() const
{
wxCHECK( m_part, false );
if( !m_part )
return false;
return m_part->IsPower();
}
+1 -10
View File
@@ -113,16 +113,7 @@ std::string SPICE_GENERATOR_RAW_SPICE::ItemParams() const
std::string SPICE_GENERATOR_RAW_SPICE::Preview( const SPICE_ITEM& aItem ) const
{
SPICE_ITEM item = aItem;
item.refName = "";
for( int i = 0; i < m_model.GetPinCount(); ++i )
{
item.pinNumbers.push_back( fmt::format( "{}", i + 1 ) );
item.pinNetNames.push_back( fmt::format( "{}", i + 1 ) );
}
return ItemLine( item );
return ItemParams();
}
+30 -18
View File
@@ -1759,26 +1759,35 @@ void SIMULATOR_FRAME_UI::updateSignalsGrid()
{
m_signalsGrid->SetCellValue( row, COL_SIGNAL_SHOW, wxS( "1" ) );
wxGridCellAttr* attr = new wxGridCellAttr;
attr->SetRenderer( new GRID_CELL_COLOR_RENDERER( this ) );
attr->SetEditor( new GRID_CELL_COLOR_SELECTOR( this, m_signalsGrid ) );
wxGridCellAttrPtr attr = m_signalsGrid->GetOrCreateCellAttrPtr( row, COL_SIGNAL_COLOR );
if( !attr->HasRenderer() )
attr->SetRenderer( new GRID_CELL_COLOR_RENDERER( this ) );
if( !attr->HasEditor() )
attr->SetEditor( new GRID_CELL_COLOR_SELECTOR( this, m_signalsGrid ) );
attr->SetAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
m_signalsGrid->SetAttr( row, COL_SIGNAL_COLOR, attr );
attr->SetReadOnly( false );
KIGFX::COLOR4D color( trace->GetPen().GetColour() );
m_signalsGrid->SetCellValue( row, COL_SIGNAL_COLOR, color.ToCSSString() );
attr = new wxGridCellAttr;
attr->SetRenderer( new wxGridCellBoolRenderer() );
attr->SetReadOnly(); // not really; we delegate interactivity to GRID_TRICKS
attr->SetAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
m_signalsGrid->SetAttr( row, COL_CURSOR_1, attr );
attr = m_signalsGrid->GetOrCreateCellAttrPtr( row, COL_CURSOR_1 );
if( !attr->HasRenderer() )
attr->SetRenderer( new wxGridCellBoolRenderer() );
attr->SetReadOnly(); // not really; we delegate interactivity to GRID_TRICKS
attr->SetAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
attr = m_signalsGrid->GetOrCreateCellAttrPtr( row, COL_CURSOR_2 );
if( !attr->HasRenderer() )
attr->SetRenderer( new wxGridCellBoolRenderer() );
attr = new wxGridCellAttr;
attr->SetRenderer( new wxGridCellBoolRenderer() );
attr->SetReadOnly(); // not really; we delegate interactivity to GRID_TRICKS
attr->SetAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
m_signalsGrid->SetAttr( row, COL_CURSOR_2, attr );
if( trace->HasCursor( 1 ) )
m_signalsGrid->SetCellValue( row, COL_CURSOR_1, wxS( "1" ) );
@@ -1794,19 +1803,22 @@ void SIMULATOR_FRAME_UI::updateSignalsGrid()
{
m_signalsGrid->SetCellValue( row, COL_SIGNAL_SHOW, wxEmptyString );
wxGridCellAttr* attr = new wxGridCellAttr;
wxGridCellAttrPtr attr = m_signalsGrid->GetOrCreateCellAttrPtr( row, COL_SIGNAL_COLOR );
attr->SetEditor( nullptr );
attr->SetRenderer( nullptr );
attr->SetReadOnly();
m_signalsGrid->SetAttr( row, COL_SIGNAL_COLOR, attr );
m_signalsGrid->SetCellValue( row, COL_SIGNAL_COLOR, wxEmptyString );
attr = new wxGridCellAttr;
attr = m_signalsGrid->GetOrCreateCellAttrPtr( row, COL_CURSOR_1 );
attr->SetEditor( nullptr );
attr->SetRenderer( nullptr );
attr->SetReadOnly();
m_signalsGrid->SetAttr( row, COL_CURSOR_1, attr );
m_signalsGrid->SetCellValue( row, COL_CURSOR_1, wxEmptyString );
attr = new wxGridCellAttr;
attr = m_signalsGrid->GetOrCreateCellAttrPtr( row, COL_CURSOR_2 );
attr->SetEditor( nullptr );
attr->SetRenderer( nullptr );
attr->SetReadOnly();
m_signalsGrid->SetAttr( row, COL_CURSOR_2, attr );
m_signalsGrid->SetCellValue( row, COL_CURSOR_2, wxEmptyString );
}
}
+3 -1
View File
@@ -137,7 +137,9 @@ wxArrayString SYMBOL_LIBRARY_MANAGER::GetLibraryNames() const
for( const wxString& libName : symTable()->GetLogicalLibs() )
{
// Database libraries are hidden from the symbol editor at the moment
if( GetLibrary( libName )->SchLibType() == SCH_IO_MGR::SCH_DATABASE )
SYMBOL_LIB_TABLE_ROW* row = GetLibrary( libName );
if( !row || row->SchLibType() == SCH_IO_MGR::SCH_DATABASE )
continue;
res.Add( libName );
+31 -20
View File
@@ -308,13 +308,8 @@ int SCH_DRAWING_TOOLS::PlaceSymbol( const TOOL_EVENT& aEvent )
SYMBOL_LIB_TABLE* libs = PROJECT_SCH::SchSymbolLibTable( &m_frame->Prj() );
SYMBOL_LIB* cache = PROJECT_SCH::SchLibs( &m_frame->Prj() )->GetCacheLibrary();
auto compareByLibID =
[]( const LIB_SYMBOL* aFirst, const LIB_SYMBOL* aSecond ) -> bool
{
return aFirst->LibId().Format() < aSecond->LibId().Format();
};
std::set<LIB_SYMBOL*, decltype( compareByLibID )> part_list( compareByLibID );
std::set<UTF8> unique_libid;
std::vector<PICKED_SYMBOL> alreadyPlaced;
for( SCH_SHEET_PATH& sheet : sheets )
{
@@ -324,22 +319,21 @@ int SCH_DRAWING_TOOLS::PlaceSymbol( const TOOL_EVENT& aEvent )
continue;
SCH_SYMBOL* s = static_cast<SCH_SYMBOL*>( item );
if( !unique_libid.insert( s->GetLibId().Format() ).second )
continue;
LIB_SYMBOL* libSymbol = SchGetLibSymbol( s->GetLibId(), libs, cache );
if( libSymbol )
part_list.insert( libSymbol );
{
PICKED_SYMBOL pickedSymbol;
pickedSymbol.LibId = libSymbol->GetLibId();
alreadyPlaced.push_back( pickedSymbol );
}
}
}
std::vector<PICKED_SYMBOL> alreadyPlaced;
for( LIB_SYMBOL* libSymbol : part_list )
{
PICKED_SYMBOL pickedSymbol;
pickedSymbol.LibId = libSymbol->GetLibId();
alreadyPlaced.push_back( pickedSymbol );
}
// Pick the symbol to be placed
bool footprintPreviews = m_frame->eeconfig()->m_Appearance.footprint_preview;
PICKED_SYMBOL sel = m_frame->PickSymbolFromLibrary( &filter, *historyList,
@@ -1190,6 +1184,24 @@ SCH_LINE* SCH_DRAWING_TOOLS::findWire( const VECTOR2I& aPosition )
}
wxString SCH_DRAWING_TOOLS::findWireLabelDriverName( SCH_LINE* aWire )
{
wxASSERT( aWire->IsWire() );
SCH_SHEET_PATH sheetPath = m_frame->GetCurrentSheet();
if( SCH_CONNECTION* wireConnection = aWire->Connection( &sheetPath ) )
{
SCH_ITEM* wireDriver = wireConnection->Driver();
if( wireDriver && wireDriver->IsType( { SCH_LABEL_T, SCH_GLOBAL_LABEL_T } ) )
return wireConnection->LocalName();
}
return wxEmptyString;
}
SCH_TEXT* SCH_DRAWING_TOOLS::createNewText( const VECTOR2I& aPosition, int aType )
{
SCHEMATIC* schematic = getModel<SCHEMATIC>();
@@ -1209,7 +1221,7 @@ SCH_TEXT* SCH_DRAWING_TOOLS::createNewText( const VECTOR2I& aPosition, int aType
textItem = labelItem;
if( SCH_LINE* wire = findWire( aPosition ) )
netName = wire->GetNetname( m_frame->GetCurrentSheet() );
netName = findWireLabelDriverName( wire );
break;
@@ -1237,7 +1249,7 @@ SCH_TEXT* SCH_DRAWING_TOOLS::createNewText( const VECTOR2I& aPosition, int aType
textItem = labelItem;
if( SCH_LINE* wire = findWire( aPosition ) )
netName = wire->GetNetname( m_frame->GetCurrentSheet() );
netName = findWireLabelDriverName( wire );
break;
@@ -2167,7 +2179,6 @@ int SCH_DRAWING_TOOLS::DrawSheet( const TOOL_EVENT& aEvent )
SCH_SHEET_PATH newPath = m_frame->GetCurrentSheet();
newPath.push_back( sheet );
m_frame->UpdateHierarchyNavigator();
m_selectionTool->AddItemToSel( sheet );
}
else
+3
View File
@@ -60,6 +60,9 @@ public:
private:
SCH_LINE* findWire( const VECTOR2I& aPosition );
///< Gets the (global) label name driving this wire, if it is driven by a label
wxString findWireLabelDriverName( SCH_LINE* aWire );
SCH_TEXT* createNewText( const VECTOR2I& aPosition, int aType );
SCH_HIERLABEL* importHierLabel( SCH_SHEET* aSheet );
+6 -6
View File
@@ -298,6 +298,12 @@ int SCH_FIND_REPLACE_TOOL::FindNext( const TOOL_EVENT& aEvent )
{
m_afterItem = item;
if( !selectedOnly )
{
m_selectionTool->ClearSelection();
m_selectionTool->AddItemToSel( item );
}
if( !item->IsBrightened() )
{
// Clear any previous brightening
@@ -309,12 +315,6 @@ int SCH_FIND_REPLACE_TOOL::FindNext( const TOOL_EVENT& aEvent )
m_foundItemHighlighted = true;
}
if( !selectedOnly )
{
m_selectionTool->ClearSelection();
m_selectionTool->AddItemToSel( item );
}
m_frame->FocusOnLocation( item->GetBoundingBox().GetCenter() );
m_frame->GetCanvas()->Refresh();
}
+22 -3
View File
@@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2019 CERN
* 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
@@ -42,8 +42,12 @@ void SCH_NAVIGATE_TOOL::ResetHistory()
void SCH_NAVIGATE_TOOL::CleanHistory()
{
wxCHECK( m_frame, /* void */ );
SCH_SHEET_LIST sheets = m_frame->Schematic().GetSheets();
wxCHECK( !sheets.empty(), /* void */ );
// Search through our history, and removing any entries
// that the no longer point to a sheet on the schematic
auto entry = m_navHistory.begin();
@@ -51,10 +55,23 @@ void SCH_NAVIGATE_TOOL::CleanHistory()
while( entry != m_navHistory.end() )
{
if( std::find( sheets.begin(), sheets.end(), *entry ) != sheets.end() )
++entry;
{
// Don't allow multiple consecutive instances of the same history.
if( ( entry != m_navHistory.begin() ) && ( *entry == *std::prev( entry ) ) )
entry = m_navHistory.erase( entry );
else
++entry;
}
else
{
entry = m_navHistory.erase( entry );
}
}
if( m_navHistory.size() <= 1 )
m_navIndex = m_navHistory.begin();
else
m_navIndex = --m_navHistory.end();
}
@@ -271,7 +288,9 @@ void SCH_NAVIGATE_TOOL::pushToHistory( SCH_SHEET_PATH aPath )
if( CanGoForward() )
m_navHistory.erase( std::next( m_navIndex ), m_navHistory.end() );
m_navHistory.push_back( aPath );
if( m_navHistory.empty() || ( *(--m_navHistory.end()) != aPath ) )
m_navHistory.push_back( aPath );
m_navIndex = --m_navHistory.end();
}
+9 -1
View File
@@ -818,8 +818,16 @@ int SYMBOL_EDITOR_EDIT_TOOL::Paste( const TOOL_EVENT& aEvent )
{
// If it's not a symbol then paste as text
newPart = new LIB_SYMBOL( "dummy_part" );
wxString pasteText( clipboardData );
// Limit of 5000 is totally arbitrary. Without a limit, pasting a bitmap image from
// eeschema makes KiCad appear to hang.
if( pasteText.Length() > 5000 )
pasteText = pasteText.Left( 5000 ) + wxT( "..." );
LIB_TEXT* newText = new LIB_TEXT( newPart );
newText->SetText( clipboardData );
newText->SetText( pasteText );
newPart->AddDrawItem( newText );
}
+2 -1
View File
@@ -224,6 +224,7 @@ void HIERARCHY_PANE::UpdateHierarchyTree()
m_events_bound = false;
}
SCH_SHEET_LIST hierarchy = m_frame->Schematic().GetUnorderedSheets();
std::set<SCH_SHEET_PATH> expandedNodes;
std::function<void( const wxTreeItemId& )> getExpandedNodes =
@@ -233,7 +234,7 @@ void HIERARCHY_PANE::UpdateHierarchyTree()
TREE_ITEM_DATA* itemData = static_cast<TREE_ITEM_DATA*>( m_tree->GetItemData( id ) );
if( m_tree->IsExpanded( id ) )
if( m_tree->IsExpanded( id ) && hierarchy.HasPath( itemData->m_SheetPath.Path() ) )
expandedNodes.emplace( itemData->m_SheetPath );
wxTreeItemIdValue cookie;
+1 -3
View File
@@ -147,9 +147,7 @@ target_link_libraries( gerbview_kiface_objects
message( STATUS "Including 3Dconnexion SpaceMouse navigation support in gerbview" )
add_subdirectory( navlib )
if( NOT MINGW )
target_link_libraries( gerbview_kiface_objects PUBLIC gerbview_navlib)
endif()
target_link_libraries( gerbview_kiface_objects PUBLIC gerbview_navlib)
add_dependencies( gerbview_kiface_objects gerbview_navlib )
+1 -1
View File
@@ -77,7 +77,7 @@ class BOARD_ITEM : public EDA_ITEM
{
public:
BOARD_ITEM( BOARD_ITEM* aParent, KICAD_T idtype, PCB_LAYER_ID aLayer = F_Cu ) :
EDA_ITEM( aParent, idtype ),
EDA_ITEM( aParent, idtype, false, true ),
m_layer( aLayer ),
m_isKnockout( false ),
m_isLocked( false ),
+12 -1
View File
@@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2012-2019 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2012-2019, 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
@@ -99,6 +99,8 @@ public:
m_initialFocusTarget = aWindow;
}
int ShowModal() override;
int ShowQuasiModal(); // disable only the parent window, otherwise modal.
void EndQuasiModal( int retCode ); // End quasi-modal mode
@@ -183,6 +185,15 @@ protected:
virtual void OnCharHook( wxKeyEvent& aEvt );
/**
* Override this method to perform dialog tear down actions not suitable for object dtor.
*
* @warning This only gets called for dialogs that are shown in the quasimodal mode. If
* you need to perform tear down actions in modal or modeless dialogs, create
* a close window event handler.
*/
virtual void TearDownQuasiModal() {}
private:
/**
* Properly handle the wxCloseEvent when in the quasimodal mode when not calling
+2 -2
View File
@@ -463,8 +463,8 @@ public:
#endif
protected:
EDA_ITEM( EDA_ITEM* parent, KICAD_T idType );
EDA_ITEM( KICAD_T idType );
EDA_ITEM( EDA_ITEM* parent, KICAD_T idType, bool isSCH_ITEM = false, bool isBOARD_ITEM = false );
EDA_ITEM( KICAD_T idType, bool isSCH_ITEM = false, bool isBOARD_ITEM = false );
EDA_ITEM( const EDA_ITEM& base );
/**
+5 -1
View File
@@ -92,7 +92,7 @@ public:
return GetFillMode() != FILL_T::NO_FILL;
}
void SetFilled( bool aFlag )
virtual void SetFilled( bool aFlag )
{
setFilled( aFlag );
}
@@ -323,6 +323,10 @@ public:
void SetLength( const double& aLength );
void SetRectangleHeight( const int& aHeight );
void SetRectangleWidth( const int& aWidth );
void SetRectangle( const long long int& aHeight, const long long int& aWidth );
void SetSegmentAngle( const EDA_ANGLE& aAngle );
-1
View File
@@ -46,7 +46,6 @@ class EDA_LIST_DIALOG;
* @return true is success or false if no PDF viewer found.
*/
bool OpenPDF( const wxString& file );
void OpenFile( const wxString& file );
/**
* @param aSrcPath is the full filename of the source.
+5
View File
@@ -113,6 +113,11 @@ public:
*/
bool HitTestMarker( const VECTOR2I& aHitPosition, int aAccuracy ) const;
/**
* Test if the given BOX2I intersects or contains the bounds of this object
*/
bool HitTestMarker( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const;
/**
* Return the orthogonal, bounding box of this object for display purposes.
*
+1 -1
View File
@@ -709,7 +709,7 @@ private:
std::unordered_map<wxString, T> m_reverseMap;
T m_undefined; // Returned if the string is not recognized
ENUM_MAP<T>()
ENUM_MAP()
{
}
};
+37 -1
View File
@@ -102,7 +102,7 @@ public:
size_t typeHash = typeid( T ).hash_code();
if( m_app_settings_cache.count( typeHash ) )
ret = dynamic_cast<T*>( m_app_settings_cache.at( typeHash ) );
ret = static_cast<T*>( m_app_settings_cache.at( typeHash ) );
if( ret )
return ret;
@@ -127,6 +127,42 @@ public:
return ret;
}
template<typename T>
T* GetAppSettings( const wxString& aFilename )
{
#ifndef __WXMAC__
return GetAppSettings<T>();
#endif
T* ret = nullptr;
size_t typeHash = typeid( T ).hash_code();
if( m_app_settings_cache.count( typeHash ) )
ret = static_cast<T*>( m_app_settings_cache.at( typeHash ) );
if( ret )
return ret;
auto it = std::find_if( m_settings.begin(), m_settings.end(),
[&]( const std::unique_ptr<JSON_SETTINGS>& aSettings )
{
return aSettings->GetFilename() == aFilename;
} );
if( it != m_settings.end() )
{
ret = static_cast<T*>( it->get() );
}
else
{
throw std::runtime_error( "Tried to GetAppSettings before registering" );
}
m_app_settings_cache[typeHash] = ret;
return ret;
}
/**
* Retrieves a color settings object that applications can read colors from.
* If the given settings file cannot be found, returns the default settings.
+7 -1
View File
@@ -83,7 +83,9 @@ enum VIEW_VISIBILITY_FLAGS {
class GAL_API VIEW_ITEM : public INSPECTABLE
{
public:
VIEW_ITEM() :
VIEW_ITEM( bool isSCH_ITEM = false, bool isBOARD_ITEM = false ) :
m_isSCH_ITEM( isSCH_ITEM ),
m_isBOARD_ITEM( isBOARD_ITEM ),
m_viewPrivData( nullptr ),
m_forcedTransparency( 0.0 )
{
@@ -94,6 +96,8 @@ public:
VIEW_ITEM( const VIEW_ITEM& aOther ) = delete;
VIEW_ITEM& operator=( const VIEW_ITEM& aOther ) = delete;
bool IsSCH_ITEM() const { return m_isSCH_ITEM; }
bool IsBOARD_ITEM() const { return m_isBOARD_ITEM; }
/**
* Return the bounding box of the item covering all its layers.
*
@@ -162,6 +166,8 @@ public:
private:
friend class VIEW;
bool m_isSCH_ITEM;
bool m_isBOARD_ITEM;
VIEW_ITEM_DATA* m_viewPrivData;
double m_forcedTransparency; ///< Additional transparency for diff'ing items.
};
-6
View File
@@ -142,12 +142,6 @@ private:
*/
WIDGET_HOTKEY_CLIENT_DATA* getHKClientData( wxTreeListItem aItem );
/**
* Get the WIDGET_HOTKEY_CLIENT_DATA form an item and assert if it isn't found. This is for
* use when the data not being present indicates an error.
*/
WIDGET_HOTKEY_CLIENT_DATA* getExpectedHkClientData( wxTreeListItem aItem );
/**
* Method updateFromClientData
* Refresh the visible text on the widget from the rows' client data objects.
+1
View File
@@ -116,6 +116,7 @@ public:
static const std::string BackupFileSuffix;
static const std::string LockFilePrefix;
static const std::string LockFileExtension;
static const std::string AutoSaveFilePrefix;
static const std::string SchematicSymbolFileExtension;
static const std::string LegacySymbolLibFileExtension;
+13 -5
View File
@@ -222,19 +222,27 @@ void DIALOG_TEMPLATE_SELECTOR::buildPageContent( const wxString& aPath, int aPag
}
else
{
wxDir sub_dir;
wxString sub_name;
wxString sub_name;
wxArrayString subdirs;
bool cont = dir.GetFirst( &sub_name, wxEmptyString, wxDIR_DIRS );
while( cont )
{
wxString sub_full = aPath + sub_name;
subdirs.Add( wxString( sub_name ) );
cont = dir.GetNext( &sub_name );
}
if( !subdirs.IsEmpty() )
subdirs.Sort();
for( const wxString& dir_name : subdirs )
{
wxDir sub_dir;
wxString sub_full = aPath + dir_name;
if( sub_dir.Open( sub_full ) )
AddTemplate( aPage, new PROJECT_TEMPLATE( sub_full ) );
cont = dir.GetNext( &sub_name );
}
}
}
+5
View File
@@ -109,7 +109,12 @@ void PANEL_KICAD_LAUNCHER::CreateLaunchers()
int row = m_toolsSizer->GetRows();
#if wxCHECK_VERSION( 3, 2, 6 )
m_toolsSizer->Add( btn, wxGBPosition( row, 0 ), wxGBSpan( 2, 1 ) );
#else
// Work around the wxGridBagSizer gap bug in wx
m_toolsSizer->Add( btn, wxGBPosition( row, 0 ), wxGBSpan( 2, 1 ), wxBOTTOM, 12 );
#endif
// Due to https://trac.wxwidgets.org/ticket/16088?cversion=0&cnum_hist=7 GTK fails to
// correctly set the BestSize of non-default-size or styled text so we need to make
+2
View File
@@ -1024,4 +1024,6 @@ void KICAD_MANAGER_FRAME::onToolbarSizeChanged()
RecreateBaseHToolbar();
m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Left()
.Layer( 2 ) );
m_auimgr.Update();
}
+18 -3
View File
@@ -1094,6 +1094,22 @@ std::unordered_map<wxString, wxBitmap> PLUGIN_CONTENT_MANAGER::GetInstalledPacka
}
struct UPDATE_CANCELLER
{
UPDATE_CANCELLER( std::shared_ptr<BACKGROUND_JOB>& aJob ) : m_jobToCancel( aJob ) {};
~UPDATE_CANCELLER()
{
if( m_jobToCancel )
{
Pgm().GetBackgroundJobMonitor().Remove( m_jobToCancel );
m_jobToCancel.reset();
}
}
std::shared_ptr<BACKGROUND_JOB>& m_jobToCancel;
};
void PLUGIN_CONTENT_MANAGER::RunBackgroundUpdate()
{
// If the thread is already running don't create it again
@@ -1106,6 +1122,8 @@ void PLUGIN_CONTENT_MANAGER::RunBackgroundUpdate()
m_updateThread = std::thread(
[this]()
{
UPDATE_CANCELLER canceller( m_updateBackgroundJob );
if( m_installed.size() == 0 )
return;
@@ -1162,9 +1180,6 @@ void PLUGIN_CONTENT_MANAGER::RunBackgroundUpdate()
return;
}
Pgm().GetBackgroundJobMonitor().Remove( m_updateBackgroundJob );
m_updateBackgroundJob = nullptr;
// Update the badge on PCM button
m_availableUpdateCallback( availableUpdateCount );
} );
+1 -1
View File
@@ -273,7 +273,7 @@
},
"update_time_utc": {
"type": "string",
"description": "Human readabla update time in UTC YYYY-MM-DD HH:MM:SS format",
"description": "Human readable update time in UTC YYYY-MM-DD HH:MM:SS format",
"pattern": "^2\\d\\d\\d-\\d\\d-\\d\\d \\d\\d:\\d\\d:\\d\\d$"
}
},
+19 -12
View File
@@ -85,7 +85,8 @@ public:
wxString path( fn.GetPathWithSep() );
bool exclude = fn.GetName().Contains( "fp-info-cache" )
|| fn.GetName().StartsWith( "_autosave-" ) || fn.GetExt().Contains( "lck" );
|| fn.GetName().StartsWith( FILEEXT::AutoSaveFilePrefix )
|| fn.GetName().StartsWith( FILEEXT::LockFilePrefix );
if( !exclude )
m_files.emplace_back( wxFileName( filename ) );
@@ -254,10 +255,10 @@ bool PROJECT_TEMPLATE::CreateProject( wxFileName& aNewProjectPath, wxString* aEr
{
currname.Replace( basename, aNewProjectPath.GetName() );
}
else if( destFile.GetExt() == "dcm"
|| destFile.GetExt() == "lib"
// Footprint libraries are directories not files, so GetExt() won't work
|| destFile.GetPath().EndsWith( ".pretty" ) )
else if( destFile.GetExt() == FILEEXT::LegacySymbolDocumentFileExtension
|| destFile.GetExt() == FILEEXT::LegacySymbolLibFileExtension
// Footprint libraries are directories not files, so GetExt() won't work
|| destFile.GetPath().EndsWith( '.' + FILEEXT::KiCadFootprintLibPathExtension ) )
{
// Don't rename project-specific libraries. This will break the library tables and
// cause broken links in the schematic/pcb.
@@ -329,6 +330,7 @@ wxString* PROJECT_TEMPLATE::GetTitle()
int start = 0;
int finish = 0;
bool done = false;
bool hasStart = false;
while( input.IsOk() && !input.Eof() && !done )
{
@@ -345,27 +347,32 @@ wxString* PROJECT_TEMPLATE::GetTitle()
if( finish != wxNOT_FOUND )
{
m_title = line( start + 7, length );
done = true;
}
else
{
m_title = line.Mid( start + 7 );
hasStart = true;
}
done = true;
}
else
{
if( finish != wxNOT_FOUND )
{
m_title += line.SubString( 0, finish );
m_title += line.SubString( 0, finish - 1 );
done = true;
}
else if( hasStart )
m_title += line;
}
// Remove line endings
m_title.Replace( wxT( "\r" ), wxT( " " ) );
m_title.Replace( wxT( "\n" ), wxT( " " ) );
}
// Remove line endings
m_title.Replace( wxT( "\r" ), wxT( "" ) );
m_title.Replace( wxT( "\n" ), wxT( "" ) );
m_title.Trim( false ); // Trim from left
m_title.Trim(); // Trim from right
}
return &m_title;
+1 -1
View File
@@ -257,7 +257,7 @@ void PROJECT_TREE_ITEM::Activate( PROJECT_TREE_PANE* aTreePrjFrame )
break;
default:
OpenFile( fullFileName );
wxLaunchDefaultApplication( fullFileName );
break;
}
}
+1
View File
@@ -29,6 +29,7 @@ set( KIMATH_SRCS
src/geometry/shape_rect.cpp
src/geometry/shape_compound.cpp
src/geometry/shape_segment.cpp
src/geometry/shape_utils.cpp
src/math/vector2.cpp
@@ -49,6 +49,7 @@
#include <math/vector2d.h> // for VECTOR2I
#include <md5_hash.h>
class CIRCLE;
/**
* Represent a set of closed polygons. Polygons may be nonconvex, self-intersecting
@@ -0,0 +1,95 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* 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 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#pragma once
#include <vector>
#include <math/vector2d.h>
#include <geometry/eda_angle.h>
/**
* @file geometry/shape_utils.h
*
* @brief Utility functions for working with shapes.
*
* These are free functions to avoid bloating the shape classes with functions
* that only need to be used in a few places and can just use the public
* interfaces.
*/
class CIRCLE;
class SHAPE_LINE_CHAIN;
class SHAPE_POLY_SET;
class SEG;
namespace KIGEOM
{
/**
* Adds a hole to a polygon if it is valid (i.e. it has 3 or more points
* and a non-zero area.)
*
* This is important if you are reading in a polygon from a file and
* aren't sure if it will end up being valid. Leaving invalid holes in
* a SHAP_POLY_SET will violate the invariant that holes are non-null.
*
* @param aOutline is the outline to add the hole to.
* @param aHole is the hole to add.
* @return true if the hole was added, false if it was not.
*/
bool AddHoleIfValid( SHAPE_POLY_SET& aOutline, SHAPE_LINE_CHAIN&& aHole );
/**
* Get the corners of a regular polygon from the centre, one point
* and the number of sides.
*/
std::vector<VECTOR2I> MakeRegularPolygonPoints( const VECTOR2I& aCenter, size_t aN,
const VECTOR2I& aPt0 );
/**
* Make a regular polygon of the given size across the corners.
*
* @param aCenter the center of the polygon
* @param aN polygon side count (e.g. 6 = hexagon)
* @param aRadius the distance from the centre to a corner/flat
* @param aAcrossCorners true if the radius is to the corners, false to the side midpoints
* @param aAngle is the angle from the centre to one point. 0 is the point is to the right,
* and CCW from there.
*/
std::vector<VECTOR2I> MakeRegularPolygonPoints( const VECTOR2I& aCenter, size_t aN, int aRadius,
bool aAcrossCorners, EDA_ANGLE aAngle );
/**
* Create the two segments for a cross
*
* @param aCenter is the center of the cross
* @param aSize is the size of the cross (can be x != y)
* @param aAngle is the angle of the cross (postive = rotate cross CCW)
*/
std::vector<SEG> MakeCrossSegments( const VECTOR2I& aCenter, const VECTOR2I& aSize,
EDA_ANGLE aAngle );
} // namespace KIGEOM
@@ -44,6 +44,7 @@
#include <clipper.hpp> // for Clipper, PolyNode, Clipp...
#include <clipper2/clipper.h>
#include <geometry/circle.h>
#include <geometry/geometry_utils.h>
#include <geometry/polygon_triangulation.h>
#include <geometry/seg.h> // for SEG, OPT_VECTOR2I
+95
View File
@@ -0,0 +1,95 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* 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 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "geometry/shape_utils.h"
#include <geometry/seg.h>
#include <geometry/shape_poly_set.h>
bool KIGEOM::AddHoleIfValid( SHAPE_POLY_SET& aOutline, SHAPE_LINE_CHAIN&& aHole )
{
if( aHole.PointCount() < 3 || aHole.Area() == 0 )
{
return false;
}
aOutline.AddHole( std::move( aHole ) );
return true;
}
std::vector<VECTOR2I> KIGEOM::MakeRegularPolygonPoints( const VECTOR2I& aCenter, size_t aN,
const VECTOR2I& aPt0 )
{
VECTOR2D pt0FromC = aPt0 - aCenter;
std::vector<VECTOR2I> pts;
for( size_t i = 0; i < aN; i++ )
{
VECTOR2D pt = pt0FromC;
RotatePoint( pt, ( FULL_CIRCLE / double( aN ) ) * i );
pts.push_back( KiROUND( pt + aCenter ) );
}
return pts;
}
std::vector<VECTOR2I> KIGEOM::MakeRegularPolygonPoints( const VECTOR2I& aCenter, size_t aN,
int aRadius, bool aAcrossCorners,
EDA_ANGLE aAngle )
{
if( !aAcrossCorners )
{
// if across flats, increase the radius
aRadius = aRadius / ( FULL_CIRCLE / ( aN * 2 ) ).Cos();
}
VECTOR2I pt = VECTOR2I{ aRadius, 0 };
RotatePoint( pt, aAngle );
const VECTOR2I pt0 = aCenter + pt;
return KIGEOM::MakeRegularPolygonPoints( aCenter, aN, pt0 );
}
std::vector<SEG> KIGEOM::MakeCrossSegments( const VECTOR2I& aCenter, const VECTOR2I& aSize,
EDA_ANGLE aAngle )
{
std::vector<SEG> segs;
VECTOR2I pt = VECTOR2I{ aSize.x / 2, 0 };
RotatePoint( pt, aAngle );
VECTOR2I pt0 = aCenter - pt;
segs.emplace_back( pt0, aCenter - ( pt0 - aCenter ) );
pt = VECTOR2I{ 0, aSize.y / 2 };
RotatePoint( pt, aAngle );
pt0 = aCenter - pt;
segs.emplace_back( pt0, aCenter - ( pt0 - aCenter ) );
return segs;
}
+6
View File
@@ -66,3 +66,9 @@ bool KIPLATFORM::IO::IsFileHidden( const wxString& aFileName )
return fn.GetName().StartsWith( wxT( "." ) );
}
void KIPLATFORM::IO::LongPathAdjustment( wxFileName& aFilename )
{
// no-op
}
+8 -2
View File
@@ -85,7 +85,7 @@ bool KIPLATFORM::UI::IsWindowActive( wxWindow* aWindow )
}
void KIPLATFORM::UI::ReparentQuasiModal( wxNonOwnedWindow* aWindow )
void KIPLATFORM::UI::ReparentModal( wxNonOwnedWindow* aWindow )
{
// Not needed on this platform
}
@@ -301,6 +301,12 @@ bool KIPLATFORM::UI::WarpPointer( wxWindow* aWindow, int aX, int aY )
aWindow->WarpPointer( aX, aY );
gdk_window_set_cursor( win, cur_cursor );
if( cur_cursor )
g_object_unref( cur_cursor );
if( blank_cursor )
g_object_unref( blank_cursor );
return true;
}
#endif
@@ -603,4 +609,4 @@ wxPoint KIPLATFORM::UI::GetMousePosition()
}
#endif
#endif
+7
View File
@@ -23,6 +23,7 @@
#include <stdio.h>
class wxString;
class wxFileName;
namespace KIPLATFORM
{
@@ -50,6 +51,12 @@ namespace IO
* @return true if the file attribut is set.
*/
bool IsFileHidden( const wxString& aFileName );
/**
* Adjusts a filename to be a long path compatible.
* This is a no-op on non-Windows platforms.
*/
void LongPathAdjustment( wxFileName& aFilename );
} // namespace IO
} // namespace KIPLATFORM
+1 -1
View File
@@ -69,7 +69,7 @@ namespace KIPLATFORM
*
* @param aWindow is the window to reparent
*/
void ReparentQuasiModal( wxNonOwnedWindow* aWindow );
void ReparentModal( wxNonOwnedWindow* aWindow );
/*
* An ugly hack to fix an issue on OSX: cmd+c closes the dialog instead of copying the
+33 -1
View File
@@ -21,7 +21,7 @@
#include <wx/string.h>
#include <wx/wxcrt.h>
#include <wx/filename.h>
#include <windows.h>
// Define USE_MSYS2_FALlBACK if the code for _MSC_VER does not compile on msys2
@@ -123,4 +123,36 @@ bool KIPLATFORM::IO::IsFileHidden( const wxString& aFileName )
result = true;
return result;
}
void KIPLATFORM::IO::LongPathAdjustment( wxFileName& aFilename )
{
// dont shortcut this for shorter lengths as there are uses like directory
// paths that exceed the path length when you start traversing their subdirectories
// so we want to start with the long path prefix all the time
if( aFilename.GetVolume().Length() == 1 )
// assume single letter == drive volume
aFilename.SetVolume( "\\\\?\\" + aFilename.GetVolume() + ":" );
else if( aFilename.GetVolume().Length() > 1
&& aFilename.GetVolume().StartsWith( wxT( "\\\\" ) )
&& !aFilename.GetVolume().StartsWith( wxT( "\\\\?" ) ) )
// unc path aka network share, wx returns with \\ already
// so skip the first slash and combine with the prefix
// which in the case of UNCs is actually \\?\UNC\<server>\<share>
// where UNC is literally the text UNC
aFilename.SetVolume( "\\\\?\\UNC" + aFilename.GetVolume().Mid( 1 ) );
else if( aFilename.GetVolume().StartsWith( wxT( "\\\\?" ) )
&& aFilename.GetDirs().size() >= 2
&& aFilename.GetDirs()[0] == "UNC" )
{
// wxWidgets can parse \\?\UNC\<server> into a mess
// UNC gets stored into a directory
// volume gets reduced to just \\?
// so we need to repair it
aFilename.SetVolume( "\\\\?\\UNC\\" + aFilename.GetDirs()[1] );
aFilename.RemoveDir( 0 );
aFilename.RemoveDir( 0 );
}
}
+1 -1
View File
@@ -90,7 +90,7 @@ bool KIPLATFORM::UI::IsWindowActive( wxWindow* aWindow )
}
void KIPLATFORM::UI::ReparentQuasiModal( wxNonOwnedWindow* aWindow )
void KIPLATFORM::UI::ReparentModal( wxNonOwnedWindow* aWindow )
{
// Not needed on this platform
}
+10 -4
View File
@@ -49,16 +49,16 @@ bool KIPLATFORM::IO::DuplicatePermissions(const wxString& sourceFilePath, const
NSNumber *permissions = sourceAttributes[NSFilePosixPermissions];
if (permissions == nil)
if (permissions == nil)
{
return false;
}
if ([fileManager setAttributes:@{NSFilePosixPermissions: permissions} ofItemAtPath:destPath error:&error])
if ([fileManager setAttributes:@{NSFilePosixPermissions: permissions} ofItemAtPath:destPath error:&error])
{
return true;
}
else
}
else
{
NSLog(@"Error assigning permissions: %@", error);
return false;
@@ -71,3 +71,9 @@ bool KIPLATFORM::IO::IsFileHidden( const wxString& aFileName )
return fn.GetName().StartsWith( wxT( "." ) );
}
void KIPLATFORM::IO::LongPathAdjustment( wxFileName& aFilename )
{
// no-op
}

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