Compare commits

..

471 Commits

Author SHA1 Message Date
Wayne Stambaugh ff2da496af Tag release version 7.0.6. 2023-07-05 08:01:08 -04:00
Steven A. Falco 9d5f85634c Allow python 3.12
(Cherry-picked from 2c983155a4)
2023-07-05 10:45:23 +01:00
Wayne Stambaugh 7efda5fbbd Tag stable release candidate 7.0.6-rc3. 2023-07-02 07:25:23 -04:00
Jeff Young 60696a895c Add DRC testing for copper graphic to zone fill collisions. 2023-06-30 11:56:40 +01:00
Seth Hillbrand 8b26f50003 SIM_VALUE stores significants in 64-bit
stol isn't neccesarily 64-bit though, so we use stoll and catch the
overflow if we have bad input data

Fixes KICAD-2EF

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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

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

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

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

This is an attempt to fix KICAD-39.

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

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

Probably Sentry KICAD-23Y.

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

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

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

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

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

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

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


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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Make sure triangulated knockout text gets clearance added when
specified.

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

(Cherry-picked from 20ec8ed303)

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


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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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

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

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

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

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

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

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

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

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

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

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


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


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

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

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

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


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

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


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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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


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

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

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

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

Hopefully fixes Sentry KICAD-KV.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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


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

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

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

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

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

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

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

(Attempted fix for Sentry KICAD-G1.)

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

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

(cherry picked from commit eed05191a9)
2023-04-14 00:07:47 +01:00
Marek Roszko 69989e4e64 Fix build error pre wx 3.1.6
(cherry picked from commit 0eefde6046)
2023-04-13 22:21:35 +00:00
Wayne Stambaugh 88999b34d3 Begin version 7.0.3 development. 2023-04-13 16:29:47 -04:00
586 changed files with 199209 additions and 92000 deletions
+1 -1
View File
@@ -14,7 +14,7 @@ default:
##########################################################################
# The variable CI_COMMIT_BEFORE_SHA is not available in normal merge requests
# so we must build the commit hash ourselves, see:
# https://gitlab.com/gitlab-org/gitlab/issues/12850
# https://gitlab.com/gitlab-org/gitlab/-/issues/12850
test_formatting:
stage: test
needs: []
+1 -1
View File
@@ -7,7 +7,7 @@ build_doxygen_docker:
- docker
before_script:
- docker info
- docker login -u gitlab-ci-token -p "$CI_BUILD_TOKEN" "$CI_REGISTRY"
- docker login -u gitlab-ci-token -p "$CI_JOB_TOKEN" "$CI_REGISTRY"
script:
- docker build -t "${CI_REGISTRY_IMAGE}/doxygen:$CI_COMMIT_BRANCH" -f ./doxygen/doxygen.Dockerfile .
- docker push "${CI_REGISTRY_IMAGE}/doxygen:$CI_COMMIT_BRANCH"
+25
View File
@@ -0,0 +1,25 @@
##########################################################################
# Test the formatting in a merge request using clang-format
##########################################################################
# The variable CI_COMMIT_BEFORE_SHA is not available in normal merge requests
# so we must build the commit hash ourselves, see:
# https://gitlab.com/gitlab-org/gitlab/-/issues/12850
test_formatting:
stage: test
needs: []
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
allow_failure: true
before_script:
# We must manually add the KiCad remote to ensure it is named sensibly
- git remote add product https://gitlab.com/kicad/code/kicad.git
- git remote add source ${CI_MERGE_REQUEST_SOURCE_PROJECT_URL}.git
- git fetch -n product
- git fetch -n source
# Get the SHAs of the commits
- "TARGET_HEAD_SHA=$(git rev-parse product/${CI_MERGE_REQUEST_TARGET_BRANCH_NAME})"
- "SOURCE_HEAD_SHA=$(git rev-parse source/${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME})"
- "MERGE_BASE_SHA=$(git merge-base ${TARGET_HEAD_SHA} ${SOURCE_HEAD_SHA})"
script:
- echo "Testing formatting from commit ${MERGE_BASE_SHA}"
- ./tools/check_coding.sh --diff --ci --commit ${MERGE_BASE_SHA}
+1 -1
View File
@@ -28,7 +28,7 @@
# GitLab supports displaying the results in the GUI through JUNIT artifacts
# (https://docs.gitlab.com/ee/ci/junit_test_reports.html)
# so we upload the JUNIT results. Note that there is a bug with how paths
# are processed in the junit report (https://gitlab.com/gitlab-org/gitlab/issues/23835)
# are processed in the junit report (https://gitlab.com/gitlab-org/gitlab/-/issues/23835)
# so we can't use a glob and have to list out each hierarchy separately.
artifacts:
reports:
+13 -8
View File
@@ -36,6 +36,7 @@
#include <pgm_base.h>
#include <settings/settings_manager.h>
#include <wx/log.h>
#include <pcbnew_settings.h>
#include <advanced_config.h>
@@ -92,8 +93,7 @@ BOARD_ADAPTER::BOARD_ADAPTER() :
{
wxLogTrace( m_logTrace, wxT( "BOARD_ADAPTER::BOARD_ADAPTER" ) );
if( PgmOrNull() )
m_colors = Pgm().GetSettingsManager().GetColorSettings();
ReloadColorSettings();
m_boardPos = VECTOR2I();
m_boardSize = VECTOR2I();
@@ -208,6 +208,15 @@ BOARD_ADAPTER::~BOARD_ADAPTER()
}
void BOARD_ADAPTER::ReloadColorSettings() noexcept
{
wxASSERT( PgmOrNull() );
PCBNEW_SETTINGS* settings = Pgm().GetSettingsManager().GetAppSettings<PCBNEW_SETTINGS>();
m_colors = Pgm().GetSettingsManager().GetColorSettings( settings->m_ColorTheme );
}
bool BOARD_ADAPTER::Is3dLayerEnabled( PCB_LAYER_ID aLayer ) const
{
wxASSERT( aLayer < PCB_LAYER_ID_COUNT );
@@ -251,7 +260,8 @@ bool BOARD_ADAPTER::Is3dLayerEnabled( PCB_LAYER_ID aLayer ) const
case B_Cu:
case F_Cu:
return !m_board || m_board->IsLayerVisible( aLayer ) || m_Cfg->m_Render.realistic;
return !m_board || m_board->IsLayerVisible( aLayer ) || m_Cfg->m_Render.realistic
|| m_board->IsFootprintHolder();
default:
// the layer is an internal copper layer, used the visibility
@@ -647,11 +657,6 @@ void BOARD_ADAPTER::InitSettings( REPORTER* aStatusReporter, REPORTER* aWarningR
}
extern bool BuildFootprintPolygonOutlines( BOARD* aBoard, SHAPE_POLY_SET& aOutlines,
int aErrorMax, int aChainingEpsilon,
OUTLINE_ERROR_HANDLER* aErrorHandler = nullptr );
bool BOARD_ADAPTER::createBoardPolygon( wxString* aErrorMsg )
{
m_board_poly.RemoveAllContours();
+2 -2
View File
@@ -100,7 +100,7 @@ public:
void SetBoard( BOARD* aBoard ) noexcept { m_board = aBoard; }
const BOARD* GetBoard() const noexcept { return m_board; }
void SetColorSettings( COLOR_SETTINGS* aSettings ) noexcept { m_colors = aSettings; }
void ReloadColorSettings() noexcept;
/**
* Function to be called by the render when it need to reload the settings for the board.
@@ -348,7 +348,7 @@ private:
PCB_LAYER_ID aLayerId );
void addText( const EDA_TEXT* aText, CONTAINER_2D_BASE* aDstContainer,
const BOARD_ITEM* aOwner );
const BOARD_ITEM* aItem );
void addShape( const PCB_SHAPE* aShape, CONTAINER_2D_BASE* aContainer,
const BOARD_ITEM* aOwner );
@@ -64,7 +64,7 @@
void BOARD_ADAPTER::addText( const EDA_TEXT* aText, CONTAINER_2D_BASE* aContainer,
const BOARD_ITEM* aOwner )
const BOARD_ITEM* aItem )
{
KIGFX::GAL_DISPLAY_OPTIONS empty_opts;
TEXT_ATTRIBUTES attrs = aText->GetAttributes();
@@ -74,34 +74,25 @@ void BOARD_ADAPTER::addText( const EDA_TEXT* aText, CONTAINER_2D_BASE* aContaine
if( !font )
font = KIFONT::FONT::GetFont( wxEmptyString, aText->IsBold(), aText->IsItalic() );
if( aOwner && aOwner->IsKnockout() )
if( aItem && aItem->IsKnockout() )
{
SHAPE_POLY_SET knockouts;
CALLBACK_GAL callback_gal( empty_opts,
// Polygon callback
[&]( const SHAPE_LINE_CHAIN& aPoly )
{
knockouts.AddOutline( aPoly );
} );
attrs.m_StrokeWidth = aText->GetEffectiveTextPenWidth();
attrs.m_Angle = aText->GetDrawRotation();
callback_gal.SetIsFill( font->IsOutline() );
callback_gal.SetIsStroke( font->IsStroke() );
callback_gal.SetLineWidth( attrs.m_StrokeWidth );
font->Draw( &callback_gal, aText->GetShownText(), aText->GetDrawPos(), attrs );
int maxError = m_board->GetDesignSettings().m_MaxError;
SHAPE_POLY_SET finalPoly;
int margin = attrs.m_StrokeWidth * 1.5 +
GetKnockoutTextMargin( attrs.m_Size, attrs.m_StrokeWidth );
aText->TransformBoundingBoxToPolygon( &finalPoly, margin );
finalPoly.BooleanSubtract( knockouts, SHAPE_POLY_SET::PM_FAST );
finalPoly.Fracture( SHAPE_POLY_SET::PM_FAST );
if( aItem->Type() == PCB_FP_TEXT_T )
{
static_cast<const FP_TEXT*>( aItem )->TransformTextToPolySet( finalPoly, 0, maxError,
ERROR_INSIDE );
}
else if( aItem->Type() == PCB_TEXT_T )
{
static_cast<const PCB_TEXT*>( aItem )->TransformTextToPolySet( finalPoly, 0, maxError,
ERROR_INSIDE );
}
ConvertPolygonToTriangles( finalPoly, *aContainer, m_biuTo3Dunits, *aOwner );
// Do not call finalPoly.Fracture() here: ConvertPolygonToTriangles() call it
// if needed, and Fracture() called twice can create bad results and is useless
ConvertPolygonToTriangles( finalPoly, *aContainer, m_biuTo3Dunits, *aItem );
}
else
{
@@ -120,24 +111,24 @@ void BOARD_ADAPTER::addText( const EDA_TEXT* aText, CONTAINER_2D_BASE* aContaine
{
// Cannot add segments that have the same start and end point
aContainer->Add( new FILLED_CIRCLE_2D( pt1_3DU, penWidth_3DU / 2,
*aOwner ) );
*aItem ) );
}
else
{
aContainer->Add( new ROUND_SEGMENT_2D( pt1_3DU, pt2_3DU, penWidth_3DU,
*aOwner ) );
*aItem ) );
}
},
// Triangulation callback
[&]( const VECTOR2I& aPt1, const VECTOR2I& aPt2, const VECTOR2I& aPt3 )
{
aContainer->Add( new TRIANGLE_2D( TO_SFVEC2F( aPt1 ), TO_SFVEC2F( aPt2 ),
TO_SFVEC2F( aPt3 ), *aOwner ) );
TO_SFVEC2F( aPt3 ), *aItem ) );
} );
attrs.m_Angle = aText->GetDrawRotation();
font->Draw( &callback_gal, aText->GetShownText(), aText->GetDrawPos(), attrs );
font->Draw( &callback_gal, aText->GetShownText( true ), aText->GetDrawPos(), attrs );
}
}
+4 -4
View File
@@ -649,7 +649,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
{
PCB_TEXT* text = static_cast<PCB_TEXT*>( item );
text->TransformTextToPolySet( *layerPoly, layer, 0, maxError, ERROR_INSIDE );
text->TransformTextToPolySet( *layerPoly, 0, maxError, ERROR_INSIDE );
break;
}
@@ -657,7 +657,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
{
PCB_TEXTBOX* textbox = static_cast<PCB_TEXTBOX*>( item );
textbox->TransformTextToPolySet( *layerPoly, layer, 0, maxError, ERROR_INSIDE );
textbox->TransformTextToPolySet( *layerPoly, 0, maxError, ERROR_INSIDE );
break;
}
@@ -958,7 +958,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
{
PCB_TEXT* text = static_cast<PCB_TEXT*>( item );
text->TransformTextToPolySet( *layerPoly, layer, 0, maxError, ERROR_INSIDE );
text->TransformTextToPolySet( *layerPoly, 0, maxError, ERROR_INSIDE );
break;
}
@@ -966,7 +966,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
{
PCB_TEXTBOX* textbox = static_cast<PCB_TEXTBOX*>( item );
textbox->TransformTextToPolySet( *layerPoly, layer, 0, maxError, ERROR_INSIDE );
textbox->TransformTextToPolySet( *layerPoly, 0, maxError, ERROR_INSIDE );
break;
}
+4 -5
View File
@@ -32,6 +32,7 @@
#include <3d_rendering/raytracing/render_3d_raytrace.h>
#include <3d_rendering/opengl/render_3d_opengl.h>
#include <3d_viewer_id.h>
#include <advanced_config.h>
#include <board.h>
#include <reporter.h>
#include <gl_context_mgr.h>
@@ -140,7 +141,7 @@ EDA_3D_CANVAS::EDA_3D_CANVAS( wxWindow* aParent, const int* aAttribList,
// long calculation time)
m_3d_render = m_3d_render_opengl;
m_boardAdapter.SetColorSettings( Pgm().GetSettingsManager().GetColorSettings() );
m_boardAdapter.ReloadColorSettings();
wxASSERT( a3DCachePointer != nullptr );
m_boardAdapter.Set3dCacheManager( a3DCachePointer );
@@ -303,7 +304,7 @@ void EDA_3D_CANVAS::ReloadRequest( BOARD* aBoard , S3D_CACHE* aCachePointer )
if( aBoard != nullptr )
m_boardAdapter.SetBoard( aBoard );
m_boardAdapter.SetColorSettings( Pgm().GetSettingsManager().GetColorSettings() );
m_boardAdapter.ReloadColorSettings();
if( m_3d_render )
m_3d_render->ReloadRequest();
@@ -531,13 +532,11 @@ void EDA_3D_CANVAS::DoRePaint()
render_pivot( curtime_delta_s, scale );
}
#if defined( KICAD_USE_3DCONNEXION )
if( m_render3dmousePivot )
if( m_render3dmousePivot && ADVANCED_CFG::GetCfg().m_Use3DConnexionDriver )
{
const float scale = glm::min( m_camera.GetZoom(), 1.0f );
render3dmousePivot( scale );
}
#endif
// "Swaps the double-buffer of this window, making the back-buffer the
// front-buffer and vice versa, so that the output of the previous OpenGL
-7
View File
@@ -178,8 +178,6 @@ public:
*/
void SetRenderPivot( bool aValue ) { m_render_pivot = aValue; }
#if defined( KICAD_USE_3DCONNEXION )
/**
* Get a value indicating whether to render the 3dmouse pivot.
*/
@@ -209,7 +207,6 @@ public:
{
m_3dmousePivotPos = aPos;
}
#endif
private:
/**
@@ -278,14 +275,12 @@ private:
*/
void render_pivot( float t, float aScale );
#if defined( KICAD_USE_3DCONNEXION )
/**
* Render the 3dmouse pivot cursor.
*
* @param aScale scale to apply on the cursor.
*/
void render3dmousePivot( float aScale );
#endif
/**
* @return true if OpenGL initialization succeeded.
@@ -331,10 +326,8 @@ private:
BOARD_ITEM* m_currentRollOverItem;
#if defined( KICAD_USE_3DCONNEXION )
bool m_render3dmousePivot = false; // Render the 3dmouse pivot
SFVEC3F m_3dmousePivotPos; // The position of the 3dmouse pivot
#endif
/**
* Trace mask used to enable or disable the trace output of this class.
@@ -120,7 +120,6 @@ void EDA_3D_CANVAS::render_pivot( float t, float aScale )
}
#if defined( KICAD_USE_3DCONNEXION )
void EDA_3D_CANVAS::render3dmousePivot( float aScale )
{
wxASSERT( aScale >= 0.0f );
@@ -160,4 +159,3 @@ void EDA_3D_CANVAS::render3dmousePivot( float aScale )
glDisable( GL_BLEND );
glDisable( GL_POINT_SMOOTH );
}
#endif
-6
View File
@@ -1,4 +1,3 @@
if( KICAD_USE_3DCONNEXION )
add_library(3d-viewer_navlib STATIC
"nl_3d_viewer_plugin.cpp"
"nl_3d_viewer_plugin_impl.cpp"
@@ -23,9 +22,4 @@ if( KICAD_USE_3DCONNEXION )
$<TARGET_PROPERTY:3DxWare::Navlib,INTERFACE_LINK_LIBRARIES>
3DxWare::Navlib
)
else()
add_library(3d-viewer_navlib STATIC
"nl_3d_viewer_plugin.cpp"
)
endif(KICAD_USE_3DCONNEXION)
+6 -22
View File
@@ -19,14 +19,14 @@
*/
#include "nl_3d_viewer_plugin.h"
#if defined( KICAD_USE_3DCONNEXION )
#include "nl_3d_viewer_plugin_impl.h"
#include <advanced_config.h>
NL_3D_VIEWER_PLUGIN::NL_3D_VIEWER_PLUGIN( EDA_3D_CANVAS* aViewport ) :
m_impl( new NL_3D_VIEWER_PLUGIN_IMPL( aViewport ) )
NL_3D_VIEWER_PLUGIN::NL_3D_VIEWER_PLUGIN( EDA_3D_CANVAS* aViewport )
{
if( ADVANCED_CFG::GetCfg().m_Use3DConnexionDriver )
m_impl = new NL_3D_VIEWER_PLUGIN_IMPL( aViewport );
}
@@ -38,22 +38,6 @@ NL_3D_VIEWER_PLUGIN::~NL_3D_VIEWER_PLUGIN()
void NL_3D_VIEWER_PLUGIN::SetFocus( bool focus )
{
m_impl->SetFocus( focus );
if( ADVANCED_CFG::GetCfg().m_Use3DConnexionDriver )
m_impl->SetFocus( focus );
}
#else
NL_3D_VIEWER_PLUGIN::NL_3D_VIEWER_PLUGIN( EDA_3D_CANVAS* aViewport ) : m_impl( nullptr )
{
}
void NL_3D_VIEWER_PLUGIN::SetFocus( bool focus )
{
}
NL_3D_VIEWER_PLUGIN::~NL_3D_VIEWER_PLUGIN()
{
}
#endif
+28 -3
View File
@@ -27,6 +27,7 @@
#include <board.h>
#include <footprint.h>
#include "../../3d_math.h"
#include "convert_basic_shapes_to_polygon.h"
#include <trigo.h>
#include <project.h>
#include <profile.h> // To use GetRunningMicroSecs or another profiling utility
@@ -775,6 +776,9 @@ void RENDER_3D_OPENGL::generateViasAndPads()
{
const PCB_VIA* via = static_cast<const PCB_VIA*>( track );
if( via->GetViaType() == VIATYPE::THROUGH )
continue; // handle with pad holes so castellation is taken into account
const float holediameter = via->GetDrillValue() * m_boardAdapter.BiuTo3dUnits();
const int nrSegments = m_boardAdapter.GetCircleSegmentCount( via->GetDrillValue() );
const float hole_inner_radius = holediameter / 2.0f;
@@ -804,14 +808,33 @@ void RENDER_3D_OPENGL::generateViasAndPads()
}
if( m_boardAdapter.GetHoleCount() > 0 )
if( m_boardAdapter.GetHoleCount() > 0 || m_boardAdapter.GetViaCount() > 0 )
{
SHAPE_POLY_SET tht_outer_holes_poly; // Stores the outer poly of the copper holes (the pad)
SHAPE_POLY_SET tht_inner_holes_poly; // Stores the inner poly of the copper holes (the hole)
SHAPE_POLY_SET tht_outer_holes_poly; // Stores the outer poly of the copper holes
SHAPE_POLY_SET tht_inner_holes_poly; // Stores the inner poly of the copper holes
tht_outer_holes_poly.RemoveAllContours();
tht_inner_holes_poly.RemoveAllContours();
// Insert through-via holes (vertical cylinders)
for( const PCB_TRACK* track : m_boardAdapter.GetBoard()->Tracks() )
{
if( track->Type() == PCB_VIA_T )
{
const PCB_VIA* via = static_cast<const PCB_VIA*>( track );
if( via->GetViaType() == VIATYPE::THROUGH )
{
TransformCircleToPolygon( tht_outer_holes_poly, via->GetPosition(),
via->GetDrill() / 2 + platingThickness,
ARC_HIGH_DEF, ERROR_INSIDE );
TransformCircleToPolygon( tht_inner_holes_poly, via->GetPosition(),
via->GetDrill() / 2, ARC_HIGH_DEF, ERROR_INSIDE );
}
}
}
// Insert pads holes (vertical cylinders)
for( const FOOTPRINT* footprint : m_boardAdapter.GetBoard()->Footprints() )
{
@@ -903,7 +926,9 @@ void RENDER_3D_OPENGL::Load3dModelsIfNeeded()
load3dModels( &activityReporter );
}
else
{
load3dModels( nullptr );
}
}
@@ -802,11 +802,14 @@ bool RENDER_3D_OPENGL::Redraw( bool aIsMoving, REPORTER* aStatusReporter,
{
setLayerMaterial( layer_id );
OPENGL_RENDER_LIST* throughHolesOuter =
m_boardAdapter.m_Cfg->m_Render.clip_silk_on_via_annulus
&& m_boardAdapter.m_Cfg->m_Render.realistic
&& ( layer_id == B_SilkS || layer_id == F_SilkS ) ? m_outerThroughHoleRings
: m_outerThroughHoles;
OPENGL_RENDER_LIST* throughHolesOuter = m_outerThroughHoles;
if( m_boardAdapter.m_Cfg->m_Render.clip_silk_on_via_annulus
&& m_boardAdapter.m_Cfg->m_Render.realistic
&& ( layer_id == B_SilkS || layer_id == F_SilkS ) )
{
throughHolesOuter = m_outerThroughHoleRings;
}
if( throughHolesOuter )
{
@@ -824,11 +827,20 @@ bool RENDER_3D_OPENGL::Redraw( bool aIsMoving, REPORTER* aStatusReporter,
- pLayerDispList->GetZBot() );
}
if( !skipRenderHoles
&& m_boardAdapter.m_Cfg->m_Render.subtract_mask_from_silk
&& m_boardAdapter.m_Cfg->m_Render.realistic
&& ( ( layer_id == B_SilkS && m_layers.find( B_Mask ) != m_layers.end() )
|| ( layer_id == F_SilkS && m_layers.find( F_Mask ) != m_layers.end() ) ) )
if( skipRenderHoles )
{
// Do not render Paste layers when skipRenderHoles is enabled
// otherwise it will cause z-fight issues
if( layer_id != B_Paste && layer_id != F_Paste )
{
pLayerDispList->DrawAllCameraCulledSubtractLayer( drawMiddleSegments,
anti_board );
}
}
else if( m_boardAdapter.m_Cfg->m_Render.subtract_mask_from_silk
&& m_boardAdapter.m_Cfg->m_Render.realistic
&& ( ( layer_id == B_SilkS && m_layers.find( B_Mask ) != m_layers.end() )
|| ( layer_id == F_SilkS && m_layers.find( F_Mask ) != m_layers.end() ) ) )
{
const PCB_LAYER_ID layerMask_id = (layer_id == B_SilkS) ? B_Mask : F_Mask;
@@ -838,25 +850,16 @@ bool RENDER_3D_OPENGL::Redraw( bool aIsMoving, REPORTER* aStatusReporter,
pLayerDispListMask,
throughHolesOuter, anti_board );
}
else if( throughHolesOuter )
{
pLayerDispList->DrawAllCameraCulledSubtractLayer( drawMiddleSegments, nullptr,
throughHolesOuter,
anti_board );
}
else
{
if( !skipRenderHoles && throughHolesOuter
&& ( layer_id == B_SilkS || layer_id == F_SilkS ) )
{
pLayerDispList->DrawAllCameraCulledSubtractLayer( drawMiddleSegments, nullptr,
throughHolesOuter,
anti_board );
}
else
{
// Do not render Paste layers when skipRenderHoles is enabled
// otherwise it will cause z-fight issues
if( !( skipRenderHoles && ( layer_id == B_Paste || layer_id == F_Paste ) ) )
{
pLayerDispList->DrawAllCameraCulledSubtractLayer( drawMiddleSegments,
anti_board );
}
}
pLayerDispList->DrawAllCameraCulledSubtractLayer( drawMiddleSegments,
anti_board );
}
}
+15 -24
View File
@@ -39,6 +39,7 @@
#include <3d_viewer/tools/eda_3d_actions.h>
#include <3d_viewer/tools/eda_3d_controller.h>
#include <3d_viewer/tools/eda_3d_conditions.h>
#include <advanced_config.h>
#include <bitmaps.h>
#include <board_design_settings.h>
#include <core/arraydim.h>
@@ -56,9 +57,7 @@
#include <widgets/wx_infobar.h>
#include <wildcards_and_files_ext.h>
#if defined( KICAD_USE_3DCONNEXION )
#include <3d_navlib/nl_3d_viewer_plugin.h>
#endif
/**
* Flag to enable 3D viewer main frame window debug tracing.
@@ -166,16 +165,18 @@ EDA_3D_VIEWER_FRAME::EDA_3D_VIEWER_FRAME( KIWAY* aKiway, PCB_BASE_FRAME* aParent
m_canvas->SetInfoBar( m_infoBar );
m_canvas->SetStatusBar( status_bar );
#if defined( KICAD_USE_3DCONNEXION )
try
if( ADVANCED_CFG::GetCfg().m_Use3DConnexionDriver )
{
m_spaceMouse = new NL_3D_VIEWER_PLUGIN( m_canvas );
try
{
m_spaceMouse = new NL_3D_VIEWER_PLUGIN( m_canvas );
}
catch( const std::system_error& e )
{
wxLogTrace( wxT( "KI_TRACE_NAVLIB" ), e.what() );
}
}
catch( const std::system_error& e )
{
wxLogTrace( wxT( "KI_TRACE_NAVLIB" ), e.what() );
}
#endif
// Fixes bug in Windows (XP and possibly others) where the canvas requires the focus
// in order to receive mouse events. Otherwise, the user has to click somewhere on
@@ -193,12 +194,7 @@ EDA_3D_VIEWER_FRAME::EDA_3D_VIEWER_FRAME( KIWAY* aKiway, PCB_BASE_FRAME* aParent
EDA_3D_VIEWER_FRAME::~EDA_3D_VIEWER_FRAME()
{
#if defined( KICAD_USE_3DCONNEXION )
if( m_spaceMouse != nullptr )
{
delete m_spaceMouse;
}
#endif
delete m_spaceMouse;
Prj().GetProjectFile().m_Viewports3D = GetUserViewports();
@@ -334,12 +330,11 @@ void EDA_3D_VIEWER_FRAME::handleIconizeEvent( wxIconizeEvent& aEvent )
{
KIWAY_PLAYER::handleIconizeEvent( aEvent );
#if defined( KICAD_USE_3DCONNEXION )
if( m_spaceMouse != nullptr && aEvent.IsIconized() )
if( m_spaceMouse != nullptr && aEvent.IsIconized()
&& ADVANCED_CFG::GetCfg().m_Use3DConnexionDriver )
{
m_spaceMouse->SetFocus( false );
}
#endif
}
@@ -655,12 +650,8 @@ void EDA_3D_VIEWER_FRAME::OnActivate( wxActivateEvent &aEvent )
m_canvas->SetFocus();
}
#if defined( KICAD_USE_3DCONNEXION )
if( m_spaceMouse != nullptr )
{
if( m_spaceMouse != nullptr && ADVANCED_CFG::GetCfg().m_Use3DConnexionDriver )
m_spaceMouse->SetFocus( aEvent.GetActive() );
}
#endif
aEvent.Skip(); // required under wxMAC
}
+3 -5
View File
@@ -122,8 +122,6 @@ target_link_libraries( 3d-viewer
add_subdirectory( 3d_cache )
if( KICAD_USE_3DCONNEXION )
message( STATUS "Including 3Dconnexion SpaceMouse navigation support in 3d-viewer" )
add_subdirectory( 3d_navlib )
target_link_libraries( 3d-viewer PRIVATE 3d-viewer_navlib)
endif()
message( STATUS "Including 3Dconnexion SpaceMouse navigation support in 3d-viewer" )
add_subdirectory( 3d_navlib )
target_link_libraries( 3d-viewer PRIVATE 3d-viewer_navlib)
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.0-39-g3487c3cb)
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@@ -26,7 +26,7 @@ PANEL_3D_RAYTRACING_OPTIONS_BASE::PANEL_3D_RAYTRACING_OPTIONS_BASE( wxWindow* pa
m_cbRaytracing_proceduralTextures = new wxCheckBox( this, wxID_ANY, _("Procedural textures (slow)"), wxDefaultPosition, wxDefaultSize, 0 );
m_cbRaytracing_proceduralTextures->SetValue(true);
gSizer1->Add( m_cbRaytracing_proceduralTextures, 0, wxALL, 5 );
gSizer1->Add( m_cbRaytracing_proceduralTextures, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_cbRaytracing_addFloor = new wxCheckBox( this, wxID_ANY, _("Add floor (slow)"), wxDefaultPosition, wxDefaultSize, 0 );
m_cbRaytracing_addFloor->SetValue(true);
@@ -347,6 +347,7 @@ PANEL_3D_RAYTRACING_OPTIONS_BASE::PANEL_3D_RAYTRACING_OPTIONS_BASE( wxWindow* pa
this->SetSizer( bSizerMain );
this->Layout();
bSizerMain->Fit( this );
}
PANEL_3D_RAYTRACING_OPTIONS_BASE::~PANEL_3D_RAYTRACING_OPTIONS_BASE()
@@ -45,7 +45,7 @@
<property name="minimum_size"></property>
<property name="name">PANEL_3D_RAYTRACING_OPTIONS_BASE</property>
<property name="pos"></property>
<property name="size">834,514</property>
<property name="size">-1,-1</property>
<property name="subclass">RESETTABLE_PANEL; widgets/resettable_panel.h; forward_declare</property>
<property name="tooltip"></property>
<property name="two_step_creation">0</property>
@@ -190,7 +190,7 @@
<property name="vgap">0</property>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="0">
<property name="BottomDockable">1</property>
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.0-39-g3487c3cb)
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@@ -103,7 +103,7 @@ class PANEL_3D_RAYTRACING_OPTIONS_BASE : public RESETTABLE_PANEL
public:
PANEL_3D_RAYTRACING_OPTIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 834,514 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
PANEL_3D_RAYTRACING_OPTIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
~PANEL_3D_RAYTRACING_OPTIONS_BASE();
+3 -1
View File
@@ -56,14 +56,16 @@ PANEL_PREVIEW_3D_MODEL::PANEL_PREVIEW_3D_MODEL( wxWindow* aParent, PCB_BASE_FRAM
m_userUnits = aFrame->GetUserUnits();
m_dummyBoard = new BOARD();
m_dummyBoard->SetProject( &aFrame->Prj(), true );
// This board will only be used to hold a footprint for viewing
m_dummyBoard->SetBoardUse( BOARD_USE::FPHOLDER );
BOARD_DESIGN_SETTINGS parent_bds = aFrame->GetDesignSettings();
BOARD_DESIGN_SETTINGS dummy_bds = m_dummyBoard->GetDesignSettings();
BOARD_DESIGN_SETTINGS& dummy_bds = m_dummyBoard->GetDesignSettings();
dummy_bds.SetBoardThickness( parent_bds.GetBoardThickness() );
dummy_bds.SetEnabledLayers( LSET::FrontMask() | LSET::BackMask() );
BOARD_STACKUP& dummy_board_stackup = m_dummyBoard->GetDesignSettings().GetStackupDescriptor();
dummy_board_stackup.RemoveAll();
dummy_board_stackup.BuildDefaultStackupList( &dummy_bds, 2 );
+6
View File
@@ -483,6 +483,12 @@ if( MSVC )
string( APPEND CMAKE_CXX_FLAGS " /EHs" )
endif()
if( KICAD_SANITIZE_ADDRESS )
add_definitions( -DKICAD_SANITIZE_ADDRESS )
add_definitions( -D_DISABLE_VECTOR_ANNOTATION )
string( APPEND CMAKE_CXX_FLAGS " /fsanitize=address" )
endif()
foreach( type EXE SHARED MODULE)
# /DEBUG: create PDB
string( APPEND CMAKE_${type}_LINKER_FLAGS " /DEBUG /MANIFEST:NO" )
+1
View File
@@ -147,6 +147,7 @@ END_EVENT_TABLE()
BM2CMP_FRAME::BM2CMP_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
BM2CMP_FRAME_BASE( aParent )
{
m_ident = FRAME_BM2CMP; // Initialized to wxID_ANY by wxFormBuilder
SetKiway( this, aKiway );
for( wxString unit : { _( "mm" ), _( "Inch" ), _( "DPI" ) } )
+1 -1
View File
@@ -37,7 +37,7 @@ unset(_Python_NAMES)
set(_PYTHON1_VERSIONS 1.6 1.5)
set(_PYTHON2_VERSIONS 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0)
set(_PYTHON3_VERSIONS 3.11 3.10 3.9 3.8 3.7 3.6 3.5 3.4 3.3 3.2 3.1 3.0)
set(_PYTHON3_VERSIONS 3.12 3.11 3.10 3.9 3.8 3.7 3.6 3.5 3.4 3.3 3.2 3.1 3.0)
# Disabling the "search every possible place" code for now
# see https://gitlab.com/kicad/code/kicad/-/issues/8553
+1 -1
View File
@@ -44,7 +44,7 @@ cmake_find_frameworks(Python)
set(_PYTHON1_VERSIONS 1.6 1.5)
set(_PYTHON2_VERSIONS 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0)
set(_PYTHON3_VERSIONS 3.11 3.10 3.9 3.8 3.7 3.6 3.5 3.4 3.3 3.2 3.1 3.0)
set(_PYTHON3_VERSIONS 3.12 3.11 3.10 3.9 3.8 3.7 3.6 3.5 3.4 3.3 3.2 3.1 3.0)
if(PythonLibs_FIND_VERSION)
if(PythonLibs_FIND_VERSION MATCHES "^[0-9]+\\.[0-9]+(\\.[0-9]+.*)?$")
+1 -1
View File
@@ -37,7 +37,7 @@
# KiCad.
#
# Note: This version string should follow the semantic versioning system
set( KICAD_SEMANTIC_VERSION "7.0.2" )
set( KICAD_SEMANTIC_VERSION "7.0.6" )
# Default the version to the semantic version.
# This is overridden by the git repository tag though (if using git)
+4 -7
View File
@@ -216,6 +216,7 @@ set( COMMON_WIDGET_SRCS
widgets/wx_panel.cpp
widgets/wx_progress_reporters.cpp
widgets/wx_splitter_window.cpp
widgets/wx_treebook.cpp
)
set( COMMON_DRAWING_SHEET_SRCS
@@ -352,7 +353,6 @@ set( COMMON_SRCS
lib_tree_model.cpp
lib_tree_model_adapter.cpp
locale_io.cpp
lockfile.cpp
lset.cpp
marker_base.cpp
markup_parser.cpp
@@ -620,12 +620,9 @@ target_link_libraries( pcbcommon PUBLIC
threadpool
)
if( KICAD_USE_3DCONNEXION )
message( STATUS "Including 3Dconnexion SpaceMouse navigation support in pcbcommon" )
add_subdirectory( ../pcbnew/navlib ./navlib)
target_link_libraries( pcbcommon PUBLIC pcbnew_navlib)
endif()
message( STATUS "Including 3Dconnexion SpaceMouse navigation support in pcbcommon" )
add_subdirectory( ../pcbnew/navlib ./navlib)
target_link_libraries( pcbcommon PUBLIC pcbnew_navlib)
add_dependencies( pcbcommon delaunator )
+25
View File
@@ -62,6 +62,16 @@ namespace AC_STACK
namespace AC_KEYS
{
/**
* Should the schematic use the new incremental connectivity algorithm
*/
static const wxChar IncrementalConnectivity[] = wxT( "IncrementalConnectivity" );
/**
* Decide whether to attempt usage of the 3DConnexion mouse
*/
static const wxChar Use3DConnexionDriver[] = wxT( "3DConnexionDriver" );
/**
* When filling zones, we add an extra amount of clearance to each zone to ensure that rounding
* errors do not overrun minimum clearance distances. This is the extra in mm.
@@ -321,6 +331,15 @@ ADVANCED_CFG::ADVANCED_CFG()
m_UseClipper2 = true;
#ifdef _WIN32
// spacemouse is largely stable on Windows
m_Use3DConnexionDriver = true;
#else
m_Use3DConnexionDriver = false;
#endif
m_IncrementalConnectivity = false;
loadFromConfigFile();
}
@@ -463,6 +482,12 @@ void ADVANCED_CFG::loadSettings( wxConfigBase& aCfg )
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::UseClipper2,
&m_UseClipper2, m_UseClipper2 ) );
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::Use3DConnexionDriver,
&m_Use3DConnexionDriver, m_Use3DConnexionDriver ) );
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::IncrementalConnectivity,
&m_IncrementalConnectivity, m_IncrementalConnectivity ) );
// Special case for trace mask setting...we just grab them and set them immediately
+37 -4
View File
@@ -41,7 +41,8 @@ BITMAP_BASE::BITMAP_BASE( const VECTOR2I& pos )
m_ppi = 300; // the bitmap definition. the default is 300PPI
m_pixelSizeIu = 254000.0 / m_ppi; // a pixel size value OK for bitmaps using 300 PPI
// for Eeschema which uses currently 254000PPI
m_isMirrored = false;
m_isMirroredX = false;
m_isMirroredY = false;
m_rotation = ANGLE_0;
}
@@ -51,7 +52,8 @@ BITMAP_BASE::BITMAP_BASE( const BITMAP_BASE& aSchBitmap )
m_scale = aSchBitmap.m_scale;
m_ppi = aSchBitmap.m_ppi;
m_pixelSizeIu = aSchBitmap.m_pixelSizeIu;
m_isMirrored = aSchBitmap.m_isMirrored;
m_isMirroredX = aSchBitmap.m_isMirroredX;
m_isMirroredY = aSchBitmap.m_isMirroredY;
m_rotation = aSchBitmap.m_rotation;
m_image = nullptr;
@@ -115,7 +117,8 @@ void BITMAP_BASE::ImportData( BITMAP_BASE* aItem )
m_scale = aItem->m_scale;
m_ppi = aItem->m_ppi;
m_pixelSizeIu = aItem->m_pixelSizeIu;
m_isMirrored = aItem->m_isMirrored;
m_isMirroredX = aItem->m_isMirroredX;
m_isMirroredY = aItem->m_isMirroredY;
m_rotation = aItem->m_rotation;
}
@@ -400,8 +403,25 @@ void BITMAP_BASE::Mirror( bool aVertically )
{
if( m_image )
{
// wxImage::Mirror() clear some parameters of the original image.
// We need to restore them, especially resolution and unit, to be
// sure image parameters saved in file are the right parameters, not
// the defualt values
int resX = m_image->GetOptionInt( wxIMAGE_OPTION_RESOLUTIONX );
int resY = m_image->GetOptionInt( wxIMAGE_OPTION_RESOLUTIONY );
int unit = m_image->GetOptionInt( wxIMAGE_OPTION_RESOLUTIONUNIT );
*m_image = m_image->Mirror( not aVertically );
m_isMirrored = !m_isMirrored;
m_image->SetOption( wxIMAGE_OPTION_RESOLUTIONUNIT , unit);
m_image->SetOption( wxIMAGE_OPTION_RESOLUTIONX, resX);
m_image->SetOption( wxIMAGE_OPTION_RESOLUTIONY, resY);
if( aVertically )
m_isMirroredY = !m_isMirroredY;
else
m_isMirroredX = !m_isMirroredX;
rebuildBitmap( false );
}
}
@@ -411,7 +431,20 @@ void BITMAP_BASE::Rotate( bool aRotateCCW )
{
if( m_image )
{
// wxImage::Rotate90() clear some parameters of the original image.
// We need to restore them, especially resolution and unit, to be
// sure image parameters saved in file are the right parameters, not
// the defualt values
int resX = m_image->GetOptionInt( wxIMAGE_OPTION_RESOLUTIONX );
int resY = m_image->GetOptionInt( wxIMAGE_OPTION_RESOLUTIONY );
int unit = m_image->GetOptionInt( wxIMAGE_OPTION_RESOLUTIONUNIT );
*m_image = m_image->Rotate90( aRotateCCW );
m_image->SetOption( wxIMAGE_OPTION_RESOLUTIONUNIT , unit);
m_image->SetOption( wxIMAGE_OPTION_RESOLUTIONX, resX);
m_image->SetOption( wxIMAGE_OPTION_RESOLUTIONY, resY);
m_rotation += ( aRotateCCW ? -ANGLE_90 : ANGLE_90 );
rebuildBitmap( false );
}
+2 -1
View File
@@ -49,8 +49,9 @@ void CALLBACK_GAL::DrawGlyph( const KIFONT::GLYPH& aGlyph, int aNth, int aTotal
int strokeWidth = GetLineWidth();
SHAPE_POLY_SET poly;
// Use ERROR_INSIDE because it avoids Clipper and is therefore much faster.
TransformOvalToPolygon( poly, pointList[ ii - 1 ], pointList[ ii ],
strokeWidth, strokeWidth / 48, ERROR_OUTSIDE );
strokeWidth, strokeWidth / 180, ERROR_INSIDE );
m_outlineCallback( poly.Outline( 0 ) );
}
+56 -32
View File
@@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2012-2022 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2012-2023 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -67,10 +67,6 @@ public:
BEGIN_EVENT_TABLE( DIALOG_SHIM, wxDialog )
// If dialog has a grid and the grid has an active cell editor
// Esc key closes cell editor, otherwise Esc key closes the dialog.
EVT_GRID_EDITOR_SHOWN( DIALOG_SHIM::OnGridEditorShown )
EVT_GRID_EDITOR_HIDDEN( DIALOG_SHIM::OnGridEditorHidden )
EVT_CHAR_HOOK( DIALOG_SHIM::OnCharHook )
END_EVENT_TABLE()
@@ -325,30 +321,38 @@ bool DIALOG_SHIM::Enable( bool enable )
// Recursive descent doing a SelectAll() in wxTextCtrls.
// MacOS User Interface Guidelines state that when tabbing to a text control all its
// text should be selected. Since wxWidgets fails to implement this, we do it here.
static void selectAllInTextCtrls( wxWindowList& children )
void DIALOG_SHIM::selectAllInTextCtrls( wxWindowList& children )
{
for( wxWindow* child : children )
{
if( wxTextCtrl* childTextCtrl = dynamic_cast<wxTextCtrl*>( child ) )
if( wxTextCtrl* textCtrl = dynamic_cast<wxTextCtrl*>( child ) )
{
m_beforeEditValues[ textCtrl ] = textCtrl->GetValue();
textCtrl->Connect( wxEVT_SET_FOCUS, wxFocusEventHandler( DIALOG_SHIM::onChildSetFocus ),
nullptr, this );
// We don't currently run this on GTK because some window managers don't hide the
// selection in non-active controls, and other window managers do the selection
// automatically anyway.
#if defined( __WXMAC__ ) || defined( __WXMSW__ )
if( !childTextCtrl->GetStringSelection().IsEmpty() )
if( !textCtrl->GetStringSelection().IsEmpty() )
{
// Respect an existing selection
}
else
else if( textCtrl->IsEditable() )
{
childTextCtrl->SelectAll();
textCtrl->SelectAll();
}
#else
ignore_unused( childTextCtrl );
ignore_unused( textCtrl );
#endif
}
else if( wxStyledTextCtrl* scintilla = dynamic_cast<wxStyledTextCtrl*>( child ) )
{
m_beforeEditValues[ scintilla ] = scintilla->GetText();
scintilla->Connect( wxEVT_SET_FOCUS, wxFocusEventHandler( DIALOG_SHIM::onChildSetFocus ),
nullptr, this );
if( !scintilla->GetSelectedText().IsEmpty() )
{
// Respect an existing selection
@@ -533,11 +537,6 @@ void DIALOG_SHIM::OnButton( wxCommandEvent& aEvent )
{
const int id = aEvent.GetId();
// If we are pressing a button to exit, we need to enable the escapeID
// otherwise the dialog does not process cancel
if( id == wxID_CANCEL )
SetEscapeId( wxID_ANY );
if( IsQuasiModal() )
{
if( id == GetAffirmativeId() )
@@ -555,7 +554,7 @@ void DIALOG_SHIM::OnButton( wxCommandEvent& aEvent )
ignore_unused( TransferDataFromWindow() );
}
}
else if( id == GetEscapeId() || (id == wxID_CANCEL && GetEscapeId() == wxID_ANY) )
else if( id == wxID_CANCEL )
{
EndQuasiModal( wxID_CANCEL );
}
@@ -572,6 +571,19 @@ void DIALOG_SHIM::OnButton( wxCommandEvent& aEvent )
}
void DIALOG_SHIM::onChildSetFocus( wxFocusEvent& aEvent )
{
// When setting focus to a text control reset the before-edit value.
if( wxTextCtrl* textCtrl = dynamic_cast<wxTextCtrl*>( aEvent.GetEventObject() ) )
m_beforeEditValues[ textCtrl ] = textCtrl->GetValue();
else if( wxStyledTextCtrl* scintilla = dynamic_cast<wxStyledTextCtrl*>( aEvent.GetEventObject() ) )
m_beforeEditValues[ scintilla ] = scintilla->GetText();
aEvent.Skip();
}
void DIALOG_SHIM::OnCharHook( wxKeyEvent& aEvt )
{
if( aEvt.GetKeyCode() == 'U' && aEvt.GetModifiers() == wxMOD_CONTROL )
@@ -583,7 +595,8 @@ void DIALOG_SHIM::OnCharHook( wxKeyEvent& aEvt )
}
}
// shift-return (Mac default) or Ctrl-Return (GTK) for OK
else if( aEvt.GetKeyCode() == WXK_RETURN && ( aEvt.ShiftDown() || aEvt.ControlDown() ) )
else if( ( aEvt.GetKeyCode() == WXK_RETURN || aEvt.GetKeyCode() == WXK_NUMPAD_ENTER )
&& ( aEvt.ShiftDown() || aEvt.ControlDown() ) )
{
wxPostEvent( this, wxCommandEvent( wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK ) );
return;
@@ -626,25 +639,36 @@ void DIALOG_SHIM::OnCharHook( wxKeyEvent& aEvt )
return;
}
}
else if( aEvt.GetKeyCode() == WXK_ESCAPE )
{
wxObject* eventSource = aEvt.GetEventObject();
if( wxTextCtrl* textCtrl = dynamic_cast<wxTextCtrl*>( eventSource ) )
{
// First escape after an edit cancels edit
if( textCtrl->GetValue() != m_beforeEditValues[ textCtrl ] )
{
textCtrl->SetValue( m_beforeEditValues[ textCtrl ] );
textCtrl->SelectAll();
return;
}
}
else if( wxStyledTextCtrl* scintilla = dynamic_cast<wxStyledTextCtrl*>( eventSource ) )
{
// First escape after an edit cancels edit
if( scintilla->GetText() != m_beforeEditValues[ scintilla ] )
{
scintilla->SetText( m_beforeEditValues[ scintilla ] );
scintilla->SelectAll();
return;
}
}
}
aEvt.Skip();
}
void DIALOG_SHIM::OnGridEditorShown( wxGridEvent& event )
{
SetEscapeId( wxID_NONE );
event.Skip();
}
void DIALOG_SHIM::OnGridEditorHidden( wxGridEvent& event )
{
SetEscapeId( wxID_ANY );
event.Skip();
}
static void recursiveDescent( wxSizer* aSizer, std::map<int, wxString>& aLabels )
{
wxStdDialogButtonSizer* sdbSizer = dynamic_cast<wxStdDialogButtonSizer*>( aSizer );
+2 -5
View File
@@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2022 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2022-2023 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -105,10 +105,7 @@ void DIALOG_ASSIGN_NETCLASS::onPatternText( wxCommandEvent& aEvent )
for( const wxString& net : m_netCandidates )
{
int matches;
int offset;
if( matcher.Find( net, matches, offset ) && offset == 0 )
if( matcher.StartsWith( net ) )
{
m_matchingNets->Report( net );
matchingNetNames.push_back( net );
+12 -10
View File
@@ -396,12 +396,12 @@ void DIALOG_COLOR_PICKER::drawRGBPalette()
// Use Y axis from bottom to top and origin to center
bitmapDC.SetAxisOrientation( true, true );
#if wxCHECK_VERSION( 3, 1, 7 )
#if wxCHECK_VERSION( 3, 1, 7 ) && defined( __WXMSW__)
// For some reason, SetDeviceOrigin has changed in wxWidgets 3.1.6 or 3.1.7
bitmapDC.SetDeviceOrigin( half_size, -half_size );
#else
#else
bitmapDC.SetDeviceOrigin( half_size, half_size );
#endif
#endif
// Reserve room to draw cursors inside the bitmap
half_size -= m_cursorsSize/2;
@@ -466,12 +466,12 @@ void DIALOG_COLOR_PICKER::drawHSVPalette()
// Use Y axis from bottom to top and origin to center
bitmapDC.SetAxisOrientation( true, true );
#if wxCHECK_VERSION( 3, 1, 7 )
#if wxCHECK_VERSION( 3, 1, 7 ) && defined( __WXMSW__)
// For some reason, SetDeviceOrigin has changed in wxWidgets 3.1.6 or 3.1.7
bitmapDC.SetDeviceOrigin( half_size, -half_size );
#else
#else
bitmapDC.SetDeviceOrigin( half_size, half_size );
#endif
#endif
// Reserve room to draw cursors inside the bitmap
half_size -= m_cursorsSize / 2;
@@ -701,11 +701,13 @@ void DIALOG_COLOR_PICKER::onHSVMouseDrag( wxMouseEvent& event )
void DIALOG_COLOR_PICKER::OnColorValueText( wxCommandEvent& event )
{
m_newColor4D.SetFromHexString( m_colorValue->GetValue() );
m_newColor4D.ToHSV( m_hue, m_sat, m_val, true );
if( m_newColor4D.SetFromHexString( m_colorValue->GetValue() ) )
{
m_newColor4D.ToHSV( m_hue, m_sat, m_val, true );
SetEditVals( HEX_CHANGED, true );
drawAll();
SetEditVals( HEX_CHANGED, false );
drawAll();
}
}
+1 -2
View File
@@ -44,9 +44,8 @@
* Ugly as it all is, it does improve our usability on various platforms.
*/
PANEL_COMMON_SETTINGS::PANEL_COMMON_SETTINGS( DIALOG_SHIM* aDialog, wxWindow* aParent )
PANEL_COMMON_SETTINGS::PANEL_COMMON_SETTINGS( wxWindow* aParent )
: PANEL_COMMON_SETTINGS_BASE( aParent ),
m_dialog( aDialog ),
m_iconScaleLabel( nullptr ),
m_iconScaleSlider( nullptr ),
m_iconScaleAuto( nullptr ),
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b3)
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@@ -415,6 +415,7 @@ PANEL_COMMON_SETTINGS_BASE::PANEL_COMMON_SETTINGS_BASE( wxWindow* parent, wxWind
this->SetSizer( bPanelSizer );
this->Layout();
bPanelSizer->Fit( this );
// Connect Events
m_textEditorBtn->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_COMMON_SETTINGS_BASE::OnTextEditorClick ), NULL, this );
@@ -45,7 +45,7 @@
<property name="minimum_size"></property>
<property name="name">PANEL_COMMON_SETTINGS_BASE</property>
<property name="pos"></property>
<property name="size">676,655</property>
<property name="size">-1,-1</property>
<property name="subclass">RESETTABLE_PANEL; widgets/resettable_panel.h; Not forward_declare</property>
<property name="tooltip"></property>
<property name="two_step_creation">0</property>
+2 -2
View File
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b3)
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@@ -113,7 +113,7 @@ class PANEL_COMMON_SETTINGS_BASE : public RESETTABLE_PANEL
public:
PANEL_COMMON_SETTINGS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 676,655 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
PANEL_COMMON_SETTINGS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
~PANEL_COMMON_SETTINGS_BASE();
+2 -2
View File
@@ -37,8 +37,8 @@
#include <settings/settings_manager.h>
PANEL_DATA_COLLECTION::PANEL_DATA_COLLECTION( PAGED_DIALOG* aDialog, wxWindow* aParent ) :
PANEL_DATA_COLLECTION_BASE( aParent ), m_dialog( aDialog )
PANEL_DATA_COLLECTION::PANEL_DATA_COLLECTION( wxWindow* aParent ) :
PANEL_DATA_COLLECTION_BASE( aParent )
{
}
+4 -4
View File
@@ -26,9 +26,8 @@
#include <wx/defs.h>
PANEL_MOUSE_SETTINGS::PANEL_MOUSE_SETTINGS( PAGED_DIALOG* aDialog, wxWindow* aParent ) :
PANEL_MOUSE_SETTINGS::PANEL_MOUSE_SETTINGS( wxWindow* aParent ) :
PANEL_MOUSE_SETTINGS_BASE( aParent ),
m_dialog( aDialog ),
m_currentScrollMod( {} )
{
#ifdef __WXOSX_MAC__
@@ -82,8 +81,9 @@ bool PANEL_MOUSE_SETTINGS::TransferDataFromWindow()
if( !isScrollModSetValid( m_currentScrollMod ) )
{
m_dialog->SetError( _( "Only one action can be assigned to each vertical scroll setting" ),
this, nullptr );
PAGED_DIALOG::GetDialog( this )->SetError( _( "Only one action can be assigned to each "
"vertical scroll setting" ),
this, nullptr );
return false;
}
+2 -1
View File
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b3)
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@@ -316,6 +316,7 @@ PANEL_MOUSE_SETTINGS_BASE::PANEL_MOUSE_SETTINGS_BASE( wxWindow* parent, wxWindow
this->SetSizer( bSizer10 );
this->Layout();
bSizer10->Fit( this );
// Connect Events
m_rbZoomNone->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( PANEL_MOUSE_SETTINGS_BASE::OnScrollRadioButton ), NULL, this );
+1 -1
View File
@@ -45,7 +45,7 @@
<property name="minimum_size"></property>
<property name="name">PANEL_MOUSE_SETTINGS_BASE</property>
<property name="pos"></property>
<property name="size">609,523</property>
<property name="size">-1,-1</property>
<property name="subclass">RESETTABLE_PANEL; widgets/resettable_panel.h; Not forward_declare</property>
<property name="tooltip"></property>
<property name="two_step_creation">0</property>
+2 -2
View File
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b3)
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@@ -97,7 +97,7 @@ class PANEL_MOUSE_SETTINGS_BASE : public RESETTABLE_PANEL
public:
PANEL_MOUSE_SETTINGS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 609,523 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
PANEL_MOUSE_SETTINGS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
~PANEL_MOUSE_SETTINGS_BASE();
+15 -21
View File
@@ -39,7 +39,6 @@
#include <widgets/wx_html_report_box.h>
#include <widgets/wx_panel.h>
#include <widgets/std_bitmap_button.h>
#include <wx/treebook.h>
#include <project/net_settings.h>
@@ -70,13 +69,12 @@ std::vector<BITMAPS> g_lineStyleIcons;
wxArrayString g_lineStyleNames;
PANEL_SETUP_NETCLASSES::PANEL_SETUP_NETCLASSES( PAGED_DIALOG* aParent, EDA_DRAW_FRAME* aFrame,
PANEL_SETUP_NETCLASSES::PANEL_SETUP_NETCLASSES( wxWindow* aParentWindow, EDA_DRAW_FRAME* aFrame,
std::shared_ptr<NET_SETTINGS> aNetSettings,
const std::set<wxString>& aNetNames,
bool aIsEEschema ) :
PANEL_SETUP_NETCLASSES_BASE( aParent->GetTreebook() ),
PANEL_SETUP_NETCLASSES_BASE( aParentWindow ),
m_frame( aFrame ),
m_parent( aParent ),
m_isEEschema( aIsEEschema ),
m_netSettings( aNetSettings ),
m_netNames( aNetNames ),
@@ -121,10 +119,8 @@ PANEL_SETUP_NETCLASSES::PANEL_SETUP_NETCLASSES( PAGED_DIALOG* aParent, EDA_DRAW_
// as this initial width is sometimes strange depending on the language (wxGrid bug?)
int const min_width = m_netclassGrid->GetVisibleWidth( i, true, true );
int const weighted_min_best_width =
( i == GRID_LINESTYLE )
? min_best_width * 3 / 2
: min_best_width;
int const weighted_min_best_width = ( i == GRID_LINESTYLE ) ? min_best_width * 3 / 2
: min_best_width;
m_netclassGrid->SetColMinimalWidth( i, min_width );
@@ -158,8 +154,8 @@ PANEL_SETUP_NETCLASSES::PANEL_SETUP_NETCLASSES( PAGED_DIALOG* aParent, EDA_DRAW_
}
wxGridCellAttr* attr = new wxGridCellAttr;
attr->SetRenderer( new GRID_CELL_COLOR_RENDERER( aParent ) );
attr->SetEditor( new GRID_CELL_COLOR_SELECTOR( aParent, m_netclassGrid ) );
attr->SetRenderer( new GRID_CELL_COLOR_RENDERER( PAGED_DIALOG::GetDialog( this ) ) );
attr->SetEditor( new GRID_CELL_COLOR_SELECTOR( PAGED_DIALOG::GetDialog( this ), m_netclassGrid ) );
m_netclassGrid->SetColAttr( GRID_SCHEMATIC_COLOR, attr );
attr = new wxGridCellAttr;
@@ -174,7 +170,6 @@ PANEL_SETUP_NETCLASSES::PANEL_SETUP_NETCLASSES( PAGED_DIALOG* aParent, EDA_DRAW_
m_netclassGrid->SetAutoEvalCols( { GRID_WIREWIDTH,
GRID_BUSWIDTH,
GRID_CLEARANCE,
GRID_TRACKSIZE,
GRID_VIASIZE,
@@ -327,6 +322,8 @@ bool PANEL_SETUP_NETCLASSES::TransferDataToWindow()
row++;
}
AdjustAssignmentGridColumns( GetSize().x * 3 / 5 );
return true;
}
@@ -428,7 +425,7 @@ bool PANEL_SETUP_NETCLASSES::validateNetclassName( int aRow, const wxString& aNa
if( tmp.IsEmpty() )
{
wxString msg = _( "Netclass must have a name." );
m_parent->SetError( msg, this, m_netclassGrid, aRow, GRID_NAME );
PAGED_DIALOG::GetDialog( this )->SetError( msg, this, m_netclassGrid, aRow, GRID_NAME );
return false;
}
@@ -437,7 +434,8 @@ bool PANEL_SETUP_NETCLASSES::validateNetclassName( int aRow, const wxString& aNa
if( ii != aRow && m_netclassGrid->GetCellValue( ii, GRID_NAME ).CmpNoCase( tmp ) == 0 )
{
wxString msg = _( "Netclass name already in use." );
m_parent->SetError( msg, this, m_netclassGrid, focusFirst ? aRow : ii, GRID_NAME );
PAGED_DIALOG::GetDialog( this )->SetError( msg, this, m_netclassGrid,
focusFirst ? aRow : ii, GRID_NAME );
return false;
}
}
@@ -652,16 +650,15 @@ void PANEL_SETUP_NETCLASSES::AdjustAssignmentGridColumns( int aWidth )
// Account for scroll bars
aWidth -= ( m_assignmentGrid->GetSize().x - m_assignmentGrid->GetClientSize().x );
// Set className column width to original className width from netclasses grid
int classNameWidth = m_originalColWidths[ 0 ];
m_assignmentGrid->SetColSize( 1, m_originalColWidths[ 0 ] );
int classNameWidth = 160;
m_assignmentGrid->SetColSize( 1, classNameWidth );
m_assignmentGrid->SetColSize( 0, std::max( aWidth - classNameWidth, classNameWidth ) );
}
void PANEL_SETUP_NETCLASSES::OnSizeAssignmentGrid( wxSizeEvent& event )
{
AdjustAssignmentGridColumns( event.GetSize().GetX());
AdjustAssignmentGridColumns( event.GetSize().GetX() );
event.Skip();
}
@@ -708,10 +705,7 @@ void PANEL_SETUP_NETCLASSES::OnUpdateUI( wxUpdateUIEvent& event )
for( const wxString& net : m_netNames )
{
int matches;
int offset;
if( matcher.Find( net, matches, offset ) && offset == 0 )
if( matcher.StartsWith( net ) )
m_matchingNets->Report( net );
}
}
@@ -74,7 +74,7 @@ PANEL_SETUP_NETCLASSES_BASE::PANEL_SETUP_NETCLASSES_BASE( wxWindow* parent, wxWi
// Cell Defaults
m_netclassGrid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
bUpperSizer->Add( m_netclassGrid, 1, wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 1 );
bUpperSizer->Add( m_netclassGrid, 1, wxEXPAND|wxFIXED_MINSIZE|wxLEFT|wxRIGHT|wxTOP, 1 );
wxBoxSizer* buttonBoxSizer;
buttonBoxSizer = new wxBoxSizer( wxHORIZONTAL );
@@ -129,7 +129,7 @@ PANEL_SETUP_NETCLASSES_BASE::PANEL_SETUP_NETCLASSES_BASE( wxWindow* parent, wxWi
m_assignmentGrid->SetMargins( 0, 0 );
// Columns
m_assignmentGrid->SetColSize( 0, 400 );
m_assignmentGrid->SetColSize( 0, 270 );
m_assignmentGrid->SetColSize( 1, 160 );
m_assignmentGrid->EnableDragColMove( false );
m_assignmentGrid->EnableDragColSize( true );
@@ -147,7 +147,7 @@ PANEL_SETUP_NETCLASSES_BASE::PANEL_SETUP_NETCLASSES_BASE( wxWindow* parent, wxWi
// Cell Defaults
m_assignmentGrid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
bSizer14->Add( m_assignmentGrid, 2, wxEXPAND|wxLEFT, 5 );
bSizer14->Add( m_assignmentGrid, 2, wxEXPAND|wxFIXED_MINSIZE|wxLEFT, 5 );
bColumns->Add( bSizer14, 3, wxEXPAND, 5 );
@@ -186,7 +186,6 @@ PANEL_SETUP_NETCLASSES_BASE::PANEL_SETUP_NETCLASSES_BASE( wxWindow* parent, wxWi
this->SetSizer( bpanelNetClassesSizer );
this->Layout();
bpanelNetClassesSizer->Fit( this );
// Connect Events
this->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( PANEL_SETUP_NETCLASSES_BASE::OnUpdateUI ) );
@@ -45,7 +45,7 @@
<property name="minimum_size">-1,-1</property>
<property name="name">PANEL_SETUP_NETCLASSES_BASE</property>
<property name="pos"></property>
<property name="size">-1,-1</property>
<property name="size">700,500</property>
<property name="subclass">; forward_declare</property>
<property name="tooltip"></property>
<property name="two_step_creation">0</property>
@@ -258,7 +258,7 @@
</object>
<object class="sizeritem" expanded="0">
<property name="border">1</property>
<property name="flag">wxEXPAND|wxLEFT|wxRIGHT|wxTOP</property>
<property name="flag">wxEXPAND|wxFIXED_MINSIZE|wxLEFT|wxRIGHT|wxTOP</property>
<property name="proportion">1</property>
<object class="wxGrid" expanded="0">
<property name="BottomDockable">1</property>
@@ -737,7 +737,7 @@
<property name="permission">none</property>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxLEFT</property>
<property name="flag">wxEXPAND|wxFIXED_MINSIZE|wxLEFT</property>
<property name="proportion">2</property>
<object class="wxGrid" expanded="0">
<property name="BottomDockable">1</property>
@@ -766,7 +766,7 @@
<property name="col_label_values">&quot;Pattern&quot; &quot;Net Class&quot;</property>
<property name="col_label_vert_alignment">wxALIGN_CENTER</property>
<property name="cols">2</property>
<property name="column_sizes">400,160</property>
<property name="column_sizes">270,160</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
+1 -1
View File
@@ -69,7 +69,7 @@ class PANEL_SETUP_NETCLASSES_BASE : public wxPanel
public:
PANEL_SETUP_NETCLASSES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
PANEL_SETUP_NETCLASSES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 700,500 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
~PANEL_SETUP_NETCLASSES_BASE();
+2 -3
View File
@@ -28,14 +28,13 @@
#include <wx/radiobut.h>
#include <wx/scrolwin.h>
#include <wx/stattext.h>
#include <wx/treebook.h>
PANEL_SETUP_SEVERITIES::PANEL_SETUP_SEVERITIES( PAGED_DIALOG* aParent,
PANEL_SETUP_SEVERITIES::PANEL_SETUP_SEVERITIES( wxWindow* aParentWindow,
std::vector<std::reference_wrapper<RC_ITEM>> aItems,
std::map<int, SEVERITY>& aSeverities,
RC_ITEM* aPinMapSpecialCase ) :
wxPanel( aParent->GetTreebook() ),
wxPanel( aParentWindow ),
m_severities( aSeverities ),
m_items( aItems ),
m_pinMapSpecialCase( aPinMapSpecialCase )
+4 -1
View File
@@ -365,7 +365,10 @@ void EDA_DRAW_PANEL_GAL::onSize( wxSizeEvent& aEvent )
if( m_view )
{
if( infobar && infobar->IsLocked() )
m_view->SetCenter( bottom - m_view->ToWorld( clientSize, false ) / 2.0 );
{
VECTOR2D halfScreen( std::ceil( 0.5 * clientSize.x ), std::ceil( 0.5 * clientSize.y ) );
m_view->SetCenter( bottom - m_view->ToWorld( halfScreen, false ) );
}
m_view->MarkTargetDirty( KIGFX::TARGET_CACHED );
m_view->MarkTargetDirty( KIGFX::TARGET_NONCACHED );
+15 -19
View File
@@ -106,13 +106,13 @@ void DS_DATA_ITEM::SyncDrawItems( DS_DRAW_ITEM_LIST* aCollector, KIGFX::VIEW* aV
for( int j = 0; j < m_RepeatCount; j++ )
{
if( j && ! IsInsidePage( j ) )
if( j > 0 && !IsInsidePage( j ) )
continue;
if( m_type == DS_SEGMENT )
item = new DS_DRAW_ITEM_LINE( this, j, GetStartPosUi( j ), GetEndPosUi( j ), pensize );
item = new DS_DRAW_ITEM_LINE( this, j, GetStartPosIU( j ), GetEndPosIU( j ), pensize );
else if( m_type == DS_RECT )
item = new DS_DRAW_ITEM_RECT( this, j, GetStartPosUi( j ), GetEndPosUi( j ), pensize );
item = new DS_DRAW_ITEM_RECT( this, j, GetStartPosIU( j ), GetEndPosIU( j ), pensize );
else
{
wxFAIL_MSG( wxS( "Unknown drawing sheet item type" ) );
@@ -162,8 +162,8 @@ void DS_DATA_ITEM::MoveTo( const VECTOR2D& aPosition )
for( DS_DRAW_ITEM_BASE* drawItem : m_drawItems )
{
drawItem->SetPosition( GetStartPosUi( drawItem->GetIndexInPeer() ) );
drawItem->SetEnd( GetEndPosUi( drawItem->GetIndexInPeer() ) );
drawItem->SetPosition( GetStartPosIU( drawItem->GetIndexInPeer() ) );
drawItem->SetEnd( GetEndPosIU( drawItem->GetIndexInPeer() ) );
}
}
@@ -294,7 +294,7 @@ const VECTOR2D DS_DATA_ITEM::GetStartPos( int ii ) const
}
const VECTOR2I DS_DATA_ITEM::GetStartPosUi( int ii ) const
const VECTOR2I DS_DATA_ITEM::GetStartPosIU( int ii ) const
{
VECTOR2D pos = GetStartPos( ii ) * DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu;
return VECTOR2I( KiROUND( pos.x ), KiROUND( pos.y ) );
@@ -331,7 +331,7 @@ const VECTOR2D DS_DATA_ITEM::GetEndPos( int ii ) const
}
const VECTOR2I DS_DATA_ITEM::GetEndPosUi( int ii ) const
const VECTOR2I DS_DATA_ITEM::GetEndPosIU( int ii ) const
{
VECTOR2D pos = GetEndPos( ii );
pos = pos * DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu;
@@ -343,17 +343,13 @@ bool DS_DATA_ITEM::IsInsidePage( int ii ) const
{
DS_DATA_MODEL& model = DS_DATA_MODEL::GetTheInstance();
VECTOR2D pos = GetStartPos( ii );
for( int kk = 0; kk < 1; kk++ )
for( const VECTOR2D& pos : { GetStartPos( ii ), GetEndPos( ii ) } )
{
if( model.m_RB_Corner.x < pos.x || model.m_LT_Corner.x > pos.x )
return false;
if( model.m_RB_Corner.y < pos.y || model.m_LT_Corner.y > pos.y )
return false;
pos = GetEndPos( ii );
}
return true;
@@ -406,11 +402,11 @@ void DS_DATA_ITEM_POLYGONS::SyncDrawItems( DS_DRAW_ITEM_LIST* aCollector, KIGFX:
for( int j = 0; j < m_RepeatCount; j++ )
{
if( j && !IsInsidePage( j ) )
if( j > 0 && !IsInsidePage( j ) )
continue;
int pensize = GetPenSizeUi();
auto poly_shape = new DS_DRAW_ITEM_POLYPOLYGONS( this, j, GetStartPosUi( j ), pensize );
auto poly_shape = new DS_DRAW_ITEM_POLYPOLYGONS( this, j, GetStartPosIU( j ), pensize );
poly_shape->SetFlags( itemFlags[ j ] );
m_drawItems.push_back( poly_shape );
@@ -584,7 +580,7 @@ void DS_DATA_ITEM_TEXT::SyncDrawItems( DS_DRAW_ITEM_LIST* aCollector, KIGFX::VIE
if( j > 0 && !IsInsidePage( j ) )
continue;
text = new DS_DRAW_ITEM_TEXT( this, j, m_FullText, GetStartPosUi( j ), textsize, pensize,
text = new DS_DRAW_ITEM_TEXT( this, j, m_FullText, GetStartPosIU( j ), textsize, pensize,
m_Font, m_Italic, m_Bold, m_TextColor );
text->SetFlags( itemFlags[ j ] );
m_drawItems.push_back( text );
@@ -595,14 +591,14 @@ void DS_DATA_ITEM_TEXT::SyncDrawItems( DS_DRAW_ITEM_LIST* aCollector, KIGFX::VIE
if( aView )
aView->Add( text );
text->SetHorizJustify( m_Hjustify ) ;
text->SetHorizJustify( m_Hjustify );
text->SetVertJustify( m_Vjustify );
text->SetTextAngle( EDA_ANGLE( m_Orient, DEGREES_T ) );
text->SetMultilineAllowed( multilines );
// Increment label for the next text (has no meaning for multiline texts)
if( m_RepeatCount > 1 && !multilines )
IncrementLabel(( j + 1 ) * m_IncrementLabel );
IncrementLabel( ( j + 1 ) * m_IncrementLabel );
}
}
@@ -746,10 +742,10 @@ void DS_DATA_ITEM_BITMAP::SyncDrawItems( DS_DRAW_ITEM_LIST* aCollector, KIGFX::V
for( int j = 0; j < m_RepeatCount; j++ )
{
if( j && !IsInsidePage( j ) )
if( j > 0 && !IsInsidePage( j ) )
continue;
DS_DRAW_ITEM_BITMAP* bitmap = new DS_DRAW_ITEM_BITMAP( this, j, GetStartPosUi( j ) );
DS_DRAW_ITEM_BITMAP* bitmap = new DS_DRAW_ITEM_BITMAP( this, j, GetStartPosIU( j ) );
bitmap->SetFlags( itemFlags[ j ] );
m_drawItems.push_back( bitmap );
+38 -3
View File
@@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2013 Jean-Pierre Charras <jp.charras at wanadoo.fr>.
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
*
*
* This program is free software; you can redistribute it and/or
@@ -118,8 +118,12 @@ void DS_DRAW_ITEM_BASE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame,
break;
case DS_DATA_ITEM::DS_TEXT:
aList.emplace_back( _( "Text" ), static_cast<DS_DRAW_ITEM_TEXT*>( this )->GetShownText() );
{
DS_DRAW_ITEM_TEXT* textItem = static_cast<DS_DRAW_ITEM_TEXT*>( this );
// Don't use GetShownText(); we want to see the variable references here
aList.emplace_back( _( "Text" ), KIUI::EllipsizeStatusText( aFrame, textItem->GetText() ) );
break;
}
case DS_DATA_ITEM::DS_POLYPOLYGON:
aList.emplace_back( _( "Imported Shape" ), wxEmptyString );
@@ -170,6 +174,37 @@ void DS_DRAW_ITEM_TEXT::PrintWsItem( const RENDER_SETTINGS* aSettings, const VEC
}
const BOX2I DS_DRAW_ITEM_TEXT::GetApproxBBox()
{
// A really dumb over-approximation because doing it for real (even with the stroke font)
// shows up large in profiles.
const TEXT_ATTRIBUTES& attrs = GetAttributes();
const wxString text = GetShownText( true );
BOX2I bbox( GetTextPos() );
bbox.SetWidth( (int) text.length() * attrs.m_Size.x * 1.3 );
bbox.SetHeight( attrs.m_Size.y );
switch( attrs.m_Halign )
{
case GR_TEXT_H_ALIGN_LEFT: break;
case GR_TEXT_H_ALIGN_CENTER: bbox.Offset( -bbox.GetWidth() / 2, 0 ); break;
case GR_TEXT_H_ALIGN_RIGHT: bbox.Offset( -bbox.GetWidth(), 0 ); break;
}
switch( GetAttributes().m_Valign )
{
case GR_TEXT_V_ALIGN_TOP: break;
case GR_TEXT_V_ALIGN_CENTER: bbox.Offset( 0, -bbox.GetHeight() / 2 ); break;
case GR_TEXT_V_ALIGN_BOTTOM: bbox.Offset( 0, -bbox.GetHeight() ); break;
}
bbox.Inflate( attrs.m_Size.x, attrs.m_Size.y / 2 );
return bbox;
}
const BOX2I DS_DRAW_ITEM_TEXT::GetBoundingBox() const
{
return EDA_TEXT::GetTextBox();
@@ -190,7 +225,7 @@ bool DS_DRAW_ITEM_TEXT::HitTest( const BOX2I& aRect, bool aContains, int aAccura
wxString DS_DRAW_ITEM_TEXT::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const
{
return wxString::Format( _( "Text '%s'" ), GetShownText() );
return wxString::Format( _( "Text '%s'" ), KIUI::EllipsizeMenuText( GetText() ) );
}
+1 -1
View File
@@ -270,7 +270,7 @@ void KIGFX::DS_PAINTER::draw( const DS_DRAW_ITEM_TEXT* aItem, int aLayer ) const
attrs.m_StrokeWidth = std::max( aItem->GetEffectiveTextPenWidth(),
m_renderSettings.GetDefaultPenWidth() );
font->Draw( m_gal, aItem->GetShownText(), aItem->GetTextPos(), attrs );
font->Draw( m_gal, aItem->GetShownText( true ), aItem->GetTextPos(), attrs );
}
+6 -1
View File
@@ -126,8 +126,13 @@ void DS_PROXY_VIEW_ITEM::ViewDraw( int aLayer, VIEW* aView ) const
ws_settings->SetDefaultFont( settings->GetDefaultFont() );
// Draw all the components that make the drawing sheet
BOX2I viewport( aView->GetViewport().GetOrigin(), aView->GetViewport().GetSize() );
for( DS_DRAW_ITEM_BASE* item = drawList.GetFirst(); item; item = drawList.GetNext() )
ws_painter.Draw( item, LAYER_DRAWINGSHEET );
{
if( viewport.Intersects( item->GetApproxBBox() ) )
ws_painter.Draw( item, LAYER_DRAWINGSHEET );
}
// Draw gray line that outlines the sheet size
if( settings->GetShowPageLimits() )
+85 -43
View File
@@ -55,13 +55,15 @@
#include <widgets/paged_dialog.h>
#include <widgets/wx_infobar.h>
#include <widgets/wx_aui_art_providers.h>
#include <widgets/wx_grid.h>
#include <widgets/wx_treebook.h>
#include <wx/app.h>
#include <wx/config.h>
#include <wx/display.h>
#include <wx/stdpaths.h>
#include <wx/string.h>
#include <wx/treebook.h>
#include <kiplatform/app.h>
#include <kiplatform/io.h>
#include <kiplatform/ui.h>
#include <functional>
@@ -166,15 +168,28 @@ EDA_BASE_FRAME::EDA_BASE_FRAME( wxWindow* aParent, FRAME_T aFrameType, const wxS
}
wxWindow* findQuasiModalDialog( wxWindow* aParent )
{
for( wxWindow* child : aParent->GetChildren() )
{
if( DIALOG_SHIM* dlg = dynamic_cast<DIALOG_SHIM*>( child ) )
{
if( dlg->IsQuasiModal() )
return dlg;
if( wxWindow* nestedDlg = findQuasiModalDialog( child ) )
return nestedDlg;
}
}
return nullptr;
}
wxWindow* EDA_BASE_FRAME::findQuasiModalDialog()
{
for( wxWindow* iter : GetChildren() )
{
DIALOG_SHIM* dlg = dynamic_cast<DIALOG_SHIM*>( iter );
if( dlg && dlg->IsQuasiModal() )
return dlg;
}
if( wxWindow* dlg = ::findQuasiModalDialog( this ) )
return dlg;
// FIXME: CvPcb is currently implemented on top of KIWAY_PLAYER rather than DIALOG_SHIM,
// so we have to look for it separately.
@@ -403,6 +418,8 @@ void EDA_BASE_FRAME::HandleUpdateUIEvent( wxUpdateUIEvent& aEvent, EDA_BASE_FRAM
enableRes = true;
else if( textEntry && isPaste && textEntry->CanPaste() )
enableRes = true;
else if( dynamic_cast<WX_GRID*>( focus ) )
enableRes = false; // Must disable menu in order to get command as CharHook event
}
aEvent.Enable( enableRes );
@@ -1005,26 +1022,45 @@ void EDA_BASE_FRAME::ShowPreferences( wxString aStartPage, wxString aStartParent
{
wxBeginBusyCursor( wxHOURGLASS_CURSOR );
PAGED_DIALOG dlg( this, _( "Preferences" ), true );
PAGED_DIALOG dlg( this, _( "Preferences" ), true, wxEmptyString, wxSize( 980, 560 ) );
dlg.SetEvtHandlerEnabled( false );
wxTreebook* book = dlg.GetTreebook();
WX_TREEBOOK* book = dlg.GetTreebook();
PANEL_HOTKEYS_EDITOR* hotkeysPanel = new PANEL_HOTKEYS_EDITOR( this, book, false );
KIFACE* kiface = nullptr;
std::vector<int> expand;
Kiway().GetActions( hotkeysPanel->ActionsList() );
book->AddPage( new PANEL_COMMON_SETTINGS( &dlg, book ), _( "Common" ) );
book->AddPage( new PANEL_MOUSE_SETTINGS( &dlg, book ), _( "Mouse and Touchpad" ) );
book->AddLazyPage(
[]( wxWindow* aParent ) -> wxWindow*
{
return new PANEL_COMMON_SETTINGS( aParent );
},
_( "Common" ) );
book->AddLazyPage(
[]( wxWindow* aParent ) -> wxWindow*
{
return new PANEL_MOUSE_SETTINGS( aParent );
}, _( "Mouse and Touchpad" ) );
book->AddPage( hotkeysPanel, _( "Hotkeys" ) );
#ifdef KICAD_USE_SENTRY
book->AddPage( new PANEL_DATA_COLLECTION( &dlg, book ), _( "Data Collection" ) );
book->AddLazyPage(
[]( wxWindow* aParent ) -> wxWindow*
{
return new PANEL_DATA_COLLECTION( aParent );
}, _( "Data Collection" ) );
#endif
#define CREATE_PANEL( key ) kiface->CreateKiWindow( book, key, &Kiway() )
#define LAZY_CTOR( key ) \
[=]( wxWindow* aParent ) \
{ \
return kiface->CreateKiWindow( aParent, key, &Kiway() ); \
}
// If a dll is not loaded, the loader will show an error message.
@@ -1038,20 +1074,19 @@ void EDA_BASE_FRAME::ShowPreferences( wxString aStartPage, wxString aStartParent
expand.push_back( book->GetPageCount() );
book->AddPage( new wxPanel( book ), _( "Symbol Editor" ) );
book->AddSubPage( CREATE_PANEL( PANEL_SYM_DISP_OPTIONS ), _( "Display Options" ) );
book->AddSubPage( CREATE_PANEL( PANEL_SYM_EDIT_OPTIONS ), _( "Editing Options" ) );
book->AddSubPage( CREATE_PANEL( PANEL_SYM_COLORS ), _( "Colors" ) );
book->AddLazySubPage( LAZY_CTOR( PANEL_SYM_DISP_OPTIONS ), _( "Display Options" ) );
book->AddLazySubPage( LAZY_CTOR( PANEL_SYM_EDIT_OPTIONS ), _( "Editing Options" ) );
book->AddLazySubPage( LAZY_CTOR( PANEL_SYM_COLORS ), _( "Colors" ) );
if( GetFrameType() == FRAME_SCH )
expand.push_back( book->GetPageCount() );
book->AddPage( new wxPanel( book ), _( "Schematic Editor" ) );
book->AddSubPage( CREATE_PANEL( PANEL_SCH_DISP_OPTIONS ), _( "Display Options" ) );
book->AddSubPage( CREATE_PANEL( PANEL_SCH_EDIT_OPTIONS ), _( "Editing Options" ) );
book->AddSubPage( CREATE_PANEL( PANEL_SCH_ANNO_OPTIONS ), _( "Annotation Options" ) );
book->AddSubPage( CREATE_PANEL( PANEL_SCH_COLORS ), _( "Colors" ) );
book->AddSubPage( CREATE_PANEL( PANEL_SCH_FIELD_NAME_TEMPLATES ),
_( "Field Name Templates" ) );
book->AddLazySubPage( LAZY_CTOR( PANEL_SCH_DISP_OPTIONS ), _( "Display Options" ) );
book->AddLazySubPage( LAZY_CTOR( PANEL_SCH_EDIT_OPTIONS ), _( "Editing Options" ) );
book->AddLazySubPage( LAZY_CTOR( PANEL_SCH_ANNO_OPTIONS ), _( "Annotation Options" ) );
book->AddLazySubPage( LAZY_CTOR( PANEL_SCH_COLORS ), _( "Colors" ) );
book->AddLazySubPage( LAZY_CTOR( PANEL_SCH_FIELD_NAME_TEMPLATES ), _( "Field Name Templates" ) );
}
catch( ... )
{
@@ -1067,29 +1102,29 @@ void EDA_BASE_FRAME::ShowPreferences( wxString aStartPage, wxString aStartParent
expand.push_back( book->GetPageCount() );
book->AddPage( new wxPanel( book ), _( "Footprint Editor" ) );
book->AddSubPage( CREATE_PANEL( PANEL_FP_DISPLAY_OPTIONS ), _( "Display Options" ) );
book->AddSubPage( CREATE_PANEL( PANEL_FP_EDIT_OPTIONS ), _( "Editing Options" ) );
book->AddSubPage( CREATE_PANEL( PANEL_FP_COLORS ), _( "Colors" ) );
book->AddSubPage( CREATE_PANEL( PANEL_FP_DEFAULT_VALUES ), _( "Default Values" ) );
book->AddLazySubPage( LAZY_CTOR( PANEL_FP_DISPLAY_OPTIONS ), _( "Display Options" ) );
book->AddLazySubPage( LAZY_CTOR( PANEL_FP_EDIT_OPTIONS ), _( "Editing Options" ) );
book->AddLazySubPage( LAZY_CTOR( PANEL_FP_COLORS ), _( "Colors" ) );
book->AddLazySubPage( LAZY_CTOR( PANEL_FP_DEFAULT_VALUES ), _( "Default Values" ) );
if( GetFrameType() == FRAME_PCB_EDITOR )
expand.push_back( book->GetPageCount() );
book->AddPage( new wxPanel( book ), _( "PCB Editor" ) );
book->AddSubPage( CREATE_PANEL( PANEL_PCB_DISPLAY_OPTIONS ), _( "Display Options" ) );
book->AddSubPage( CREATE_PANEL( PANEL_PCB_EDIT_OPTIONS ), _( "Editing Options" ) );
book->AddSubPage( CREATE_PANEL( PANEL_PCB_COLORS ), _( "Colors" ) );
book->AddSubPage( CREATE_PANEL( PANEL_PCB_ACTION_PLUGINS ), _( "Action Plugins" ) );
book->AddSubPage( CREATE_PANEL( PANEL_PCB_ORIGINS_AXES ), _( "Origins & Axes" ) );
book->AddLazySubPage( LAZY_CTOR( PANEL_PCB_DISPLAY_OPTIONS ), _( "Display Options" ) );
book->AddLazySubPage( LAZY_CTOR( PANEL_PCB_EDIT_OPTIONS ), _( "Editing Options" ) );
book->AddLazySubPage( LAZY_CTOR( PANEL_PCB_COLORS ), _( "Colors" ) );
book->AddLazySubPage( LAZY_CTOR( PANEL_PCB_ACTION_PLUGINS ), _( "Action Plugins" ) );
book->AddLazySubPage( LAZY_CTOR( PANEL_PCB_ORIGINS_AXES ), _( "Origins & Axes" ) );
if( GetFrameType() == FRAME_PCB_DISPLAY3D )
expand.push_back( book->GetPageCount() );
book->AddPage( new wxPanel( book ), _( "3D Viewer" ) );
book->AddSubPage( CREATE_PANEL( PANEL_3DV_DISPLAY_OPTIONS ), _( "General" ) );
book->AddSubPage( CREATE_PANEL( PANEL_3DV_OPENGL ), _( "Realtime Renderer" ) );
book->AddSubPage( CREATE_PANEL( PANEL_3DV_RAYTRACING ), _( "Raytracing Renderer" ) );
book->AddSubPage( CREATE_PANEL( PANEL_3DV_COLORS ), _( "Colors" ) );
book->AddLazySubPage( LAZY_CTOR( PANEL_3DV_DISPLAY_OPTIONS ), _( "General" ) );
book->AddLazySubPage( LAZY_CTOR( PANEL_3DV_OPENGL ), _( "Realtime Renderer" ) );
book->AddLazySubPage( LAZY_CTOR( PANEL_3DV_RAYTRACING ), _( "Raytracing Renderer" ) );
book->AddLazySubPage( LAZY_CTOR( PANEL_3DV_COLORS ), _( "Colors" ) );
}
catch( ... )
{
@@ -1105,9 +1140,9 @@ void EDA_BASE_FRAME::ShowPreferences( wxString aStartPage, wxString aStartParent
expand.push_back( book->GetPageCount() );
book->AddPage( new wxPanel( book ), _( "Gerber Viewer" ) );
book->AddSubPage( CREATE_PANEL( PANEL_GBR_DISPLAY_OPTIONS ), _( "Display Options" ) );
book->AddSubPage( CREATE_PANEL( PANEL_GBR_COLORS ), _( "Colors" ) );
book->AddSubPage( CREATE_PANEL( PANEL_GBR_EXCELLON_OPTIONS ), _( "Excellon Options" ) );
book->AddLazySubPage( LAZY_CTOR( PANEL_GBR_DISPLAY_OPTIONS ), _( "Display Options" ) );
book->AddLazySubPage( LAZY_CTOR( PANEL_GBR_COLORS ), _( "Colors" ) );
book->AddLazySubPage( LAZY_CTOR( PANEL_GBR_EXCELLON_OPTIONS ), _( "Excellon Options" ) );
}
catch( ... )
{
@@ -1122,10 +1157,14 @@ void EDA_BASE_FRAME::ShowPreferences( wxString aStartPage, wxString aStartParent
expand.push_back( book->GetPageCount() );
book->AddPage( new wxPanel( book ), _( "Drawing Sheet Editor" ) );
book->AddSubPage( CREATE_PANEL( PANEL_DS_DISPLAY_OPTIONS ), _( "Display Options" ) );
book->AddSubPage( CREATE_PANEL( PANEL_DS_COLORS ), _( "Colors" ) );
book->AddLazySubPage( LAZY_CTOR( PANEL_DS_DISPLAY_OPTIONS ), _( "Display Options" ) );
book->AddLazySubPage( LAZY_CTOR( PANEL_DS_COLORS ), _( "Colors" ) );
book->AddPage( new PANEL_PCM_SETTINGS( book ), _( "Plugin and Content Manager" ) );
book->AddLazyPage(
[]( wxWindow* aParent ) -> wxWindow*
{
return new PANEL_PCM_SETTINGS( aParent );
}, _( "Plugin and Content Manager" ) );
}
catch( ... )
{
@@ -1153,7 +1192,7 @@ void EDA_BASE_FRAME::ShowPreferences( wxString aStartPage, wxString aStartParent
dlg.Kiway().CommonSettingsChanged( false, false );
}
#undef CREATE_PANEL
#undef LAZY_CTOR
}
@@ -1265,6 +1304,9 @@ void EDA_BASE_FRAME::CheckForAutoSaveFile( const wxFileName& aFileName )
// the file name.
if( response == wxYES )
{
// Preserve the permissions of the current file
KIPLATFORM::IO::DuplicatePermissions( aFileName.GetFullPath(), autoSaveFileName.GetFullPath() );
if( !wxRenameFile( autoSaveFileName.GetFullPath(), aFileName.GetFullPath() ) )
{
wxMessageBox( _( "The auto save file could not be renamed to the board file name." ),
+4
View File
@@ -144,6 +144,10 @@ bool GetAssociatedDocument( wxWindow* aParent, const wxString& aDocName, PROJECT
wxFileName currentFileName( fullfilename );
// Use wxWidgets to resolve any "." and ".." in the path
currentFileName.MakeAbsolute();
fullfilename = currentFileName.GetFullPath();
wxString file_ext = currentFileName.GetExt();
if( file_ext.Lower() == wxT( "pdf" ) )
+26 -32
View File
@@ -27,6 +27,7 @@
#include <bitmaps.h>
#include <confirm.h>
#include <core/arraydim.h>
#include <core/kicad_algo.h>
#include <dialog_shim.h>
#include <eda_draw_frame.h>
#include <file_history.h>
@@ -216,15 +217,22 @@ EDA_DRAW_FRAME::~EDA_DRAW_FRAME()
void EDA_DRAW_FRAME::ReleaseFile()
{
m_file_checker = nullptr;
if( m_file_checker.get() != nullptr )
m_file_checker->UnlockFile();
}
bool EDA_DRAW_FRAME::LockFile( const wxString& aFileName )
{
m_file_checker = ::LockFile( aFileName );
// We need to explicitly reset here to get the deletion before
// we create a new unique_ptr that may be for the same file
m_file_checker.reset();
return m_file_checker && !m_file_checker->IsAnotherRunning();
m_file_checker = std::make_unique<LOCKFILE>( aFileName );
// If the file is valid, return true. This could mean that the file is
// locked or it could mean that the file is read-only
return m_file_checker->Valid();
}
@@ -741,21 +749,21 @@ void EDA_DRAW_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
void EDA_DRAW_FRAME::AppendMsgPanel( const wxString& aTextUpper, const wxString& aTextLower,
int aPadding )
{
if( m_messagePanel )
if( m_messagePanel && !m_isClosing )
m_messagePanel->AppendMessage( aTextUpper, aTextLower, aPadding );
}
void EDA_DRAW_FRAME::ClearMsgPanel()
{
if( m_messagePanel )
if( m_messagePanel && !m_isClosing )
m_messagePanel->EraseMsgBox();
}
void EDA_DRAW_FRAME::SetMsgPanel( const std::vector<MSG_PANEL_ITEM>& aList )
{
if( m_messagePanel )
if( m_messagePanel && !m_isClosing )
{
m_messagePanel->EraseMsgBox();
@@ -768,10 +776,9 @@ void EDA_DRAW_FRAME::SetMsgPanel( const std::vector<MSG_PANEL_ITEM>& aList )
void EDA_DRAW_FRAME::SetMsgPanel( const wxString& aTextUpper, const wxString& aTextLower,
int aPadding )
{
if( m_messagePanel )
if( m_messagePanel && !m_isClosing )
{
m_messagePanel->EraseMsgBox();
m_messagePanel->AppendMessage( aTextUpper, aTextLower, aPadding );
}
}
@@ -842,26 +849,15 @@ bool EDA_DRAW_FRAME::saveCanvasTypeSetting( EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvas
// Not all classes derived from EDA_DRAW_FRAME can save the canvas type, because some
// have a fixed type, or do not have a option to set the canvas type (they inherit from
// a parent frame)
FRAME_T allowed_frames[] =
{
FRAME_SCH, FRAME_SCH_SYMBOL_EDITOR,
FRAME_PCB_EDITOR, FRAME_FOOTPRINT_EDITOR,
FRAME_GERBER,
FRAME_PL_EDITOR
};
static std::vector<FRAME_T> s_allowedFrames =
{
FRAME_SCH, FRAME_SCH_SYMBOL_EDITOR,
FRAME_PCB_EDITOR, FRAME_FOOTPRINT_EDITOR,
FRAME_GERBER,
FRAME_PL_EDITOR
};
bool allow_save = false;
for( unsigned ii = 0; ii < arrayDim( allowed_frames ); ii++ )
{
if( m_ident == allowed_frames[ii] )
{
allow_save = true;
break;
}
}
if( !allow_save )
if( !alg::contains( s_allowedFrames, m_ident ) )
return false;
if( aCanvasType < EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE
@@ -871,9 +867,7 @@ bool EDA_DRAW_FRAME::saveCanvasTypeSetting( EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvas
return false;
}
APP_SETTINGS_BASE* cfg = Kiface().KifaceSettings();
if( cfg )
if( APP_SETTINGS_BASE* cfg = Kiface().KifaceSettings() )
cfg->m_Graphics.canvas_type = static_cast<int>( aCanvasType );
return false;
@@ -883,7 +877,7 @@ bool EDA_DRAW_FRAME::saveCanvasTypeSetting( EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvas
VECTOR2I EDA_DRAW_FRAME::GetNearestGridPosition( const VECTOR2I& aPosition ) const
{
const VECTOR2I& gridOrigin = GetGridOrigin();
VECTOR2D gridSize = GetCanvas()->GetGAL()->GetGridSize();
VECTOR2D gridSize = GetCanvas()->GetGAL()->GetGridSize();
double xOffset = fmod( gridOrigin.x, gridSize.x );
int x = KiROUND( (aPosition.x - xOffset) / gridSize.x );
@@ -897,7 +891,7 @@ VECTOR2I EDA_DRAW_FRAME::GetNearestGridPosition( const VECTOR2I& aPosition ) con
VECTOR2I EDA_DRAW_FRAME::GetNearestHalfGridPosition( const VECTOR2I& aPosition ) const
{
const VECTOR2I& gridOrigin = GetGridOrigin();
VECTOR2D gridSize = GetCanvas()->GetGAL()->GetGridSize() / 2.0;
VECTOR2D gridSize = GetCanvas()->GetGAL()->GetGridSize() / 2.0;
double xOffset = fmod( gridOrigin.x, gridSize.x );
int x = KiROUND( (aPosition.x - xOffset) / gridSize.x );
+24
View File
@@ -412,6 +412,30 @@ bool EDA_COMBINED_MATCHER::Find( const wxString& aTerm, int& aMatchersTriggered,
}
bool EDA_COMBINED_MATCHER::Find( const wxString& aTerm )
{
for( const std::unique_ptr<EDA_PATTERN_MATCH>& matcher : m_matchers )
{
if( matcher->Find( aTerm ).start >= 0 )
return true;
}
return false;
}
bool EDA_COMBINED_MATCHER::StartsWith( const wxString& aTerm )
{
for( const std::unique_ptr<EDA_PATTERN_MATCH>& matcher : m_matchers )
{
if( matcher->Find( aTerm ).start == 0 )
return true;
}
return false;
}
wxString const& EDA_COMBINED_MATCHER::GetPattern() const
{
return m_pattern;
+65 -53
View File
@@ -37,6 +37,7 @@
#include <callback_gal.h>
#include <eda_text.h> // for EDA_TEXT, TEXT_EFFECTS, GR_TEXT_VJUSTIF...
#include <gal/color4d.h> // for COLOR4D, COLOR4D::BLACK
#include <font/glyph.h>
#include <gr_text.h>
#include <string_utils.h> // for UnescapeString
#include <math/util.h> // for KiROUND
@@ -90,6 +91,7 @@ GR_TEXT_V_ALIGN_T EDA_TEXT::MapVertJustify( int aVertJustify )
EDA_TEXT::EDA_TEXT( const EDA_IU_SCALE& aIuScale, const wxString& aText ) :
m_text( aText ),
m_IuScale( aIuScale ),
m_render_cache_font( nullptr ),
m_bounding_box_cache_valid( false ),
m_bounding_box_cache_line( -1 ),
m_bounding_box_cache_inverted( false )
@@ -110,15 +112,19 @@ EDA_TEXT::EDA_TEXT( const EDA_TEXT& aText ) :
m_attributes = aText.m_attributes;
m_pos = aText.m_pos;
m_render_cache_font = aText.m_render_cache_font;
m_render_cache_text = aText.m_render_cache_text;
m_render_cache_angle = aText.m_render_cache_angle;
m_render_cache_offset = aText.m_render_cache_offset;
m_render_cache.clear();
for( const std::unique_ptr<KIFONT::GLYPH>& glyph : aText.m_render_cache )
{
KIFONT::OUTLINE_GLYPH* outline_glyph = static_cast<KIFONT::OUTLINE_GLYPH*>( glyph.get() );
m_render_cache.emplace_back( std::make_unique<KIFONT::OUTLINE_GLYPH>( *outline_glyph ) );
if( KIFONT::OUTLINE_GLYPH* outline = dynamic_cast<KIFONT::OUTLINE_GLYPH*>( glyph.get() ) )
m_render_cache.emplace_back( std::make_unique<KIFONT::OUTLINE_GLYPH>( *outline ) );
else if( KIFONT::STROKE_GLYPH* stroke = dynamic_cast<KIFONT::STROKE_GLYPH*>( glyph.get() ) )
m_render_cache.emplace_back( std::make_unique<KIFONT::STROKE_GLYPH>( *stroke ) );
}
m_bounding_box_cache_valid = aText.m_bounding_box_cache_valid;
@@ -142,15 +148,19 @@ EDA_TEXT& EDA_TEXT::operator=( const EDA_TEXT& aText )
m_attributes = aText.m_attributes;
m_pos = aText.m_pos;
m_render_cache_font = aText.m_render_cache_font;
m_render_cache_text = aText.m_render_cache_text;
m_render_cache_angle = aText.m_render_cache_angle;
m_render_cache_offset = aText.m_render_cache_offset;
m_render_cache.clear();
for( const std::unique_ptr<KIFONT::GLYPH>& glyph : aText.m_render_cache )
{
KIFONT::OUTLINE_GLYPH* outline_glyph = static_cast<KIFONT::OUTLINE_GLYPH*>( glyph.get() );
m_render_cache.emplace_back( std::make_unique<KIFONT::OUTLINE_GLYPH>( *outline_glyph ) );
if( KIFONT::OUTLINE_GLYPH* outline = dynamic_cast<KIFONT::OUTLINE_GLYPH*>( glyph.get() ) )
m_render_cache.emplace_back( std::make_unique<KIFONT::OUTLINE_GLYPH>( *outline ) );
else if( KIFONT::STROKE_GLYPH* stroke = dynamic_cast<KIFONT::STROKE_GLYPH*>( glyph.get() ) )
m_render_cache.emplace_back( std::make_unique<KIFONT::STROKE_GLYPH>( *stroke ) );
}
m_bounding_box_cache_valid = aText.m_bounding_box_cache_valid;
@@ -388,10 +398,18 @@ void EDA_TEXT::SetTextY( int aY )
void EDA_TEXT::Offset( const VECTOR2I& aOffset )
{
if( aOffset.x == 0 && aOffset.y == 0 )
return;
m_pos += aOffset;
for( std::unique_ptr<KIFONT::GLYPH>& glyph : m_render_cache )
static_cast<KIFONT::OUTLINE_GLYPH*>( glyph.get() )->Move( aOffset );
{
if( KIFONT::OUTLINE_GLYPH* outline = dynamic_cast<KIFONT::OUTLINE_GLYPH*>( glyph.get() ) )
outline->Move( aOffset );
else if( KIFONT::STROKE_GLYPH* stroke = dynamic_cast<KIFONT::STROKE_GLYPH*>( glyph.get() ) )
glyph = stroke->Transform( { 1.0, 1.0 }, aOffset, 0, ANGLE_0, false, { 0, 0 } );
}
m_bounding_box_cache_valid = false;
}
@@ -451,23 +469,26 @@ std::vector<std::unique_ptr<KIFONT::GLYPH>>*
EDA_TEXT::GetRenderCache( const KIFONT::FONT* aFont, const wxString& forResolvedText,
const VECTOR2I& aOffset ) const
{
if( getDrawFont()->IsOutline() )
if( aFont->IsOutline() )
{
EDA_ANGLE resolvedAngle = GetDrawRotation();
if( m_render_cache.empty()
|| m_render_cache_font != aFont
|| m_render_cache_text != forResolvedText
|| m_render_cache_angle != resolvedAngle
|| m_render_cache_offset != aOffset )
{
m_render_cache.clear();
KIFONT::OUTLINE_FONT* font = static_cast<KIFONT::OUTLINE_FONT*>( getDrawFont() );
TEXT_ATTRIBUTES attrs = GetAttributes();
const KIFONT::OUTLINE_FONT* font = static_cast<const KIFONT::OUTLINE_FONT*>( aFont );
TEXT_ATTRIBUTES attrs = GetAttributes();
attrs.m_Angle = resolvedAngle;
font->GetLinesAsGlyphs( &m_render_cache, GetShownText(), GetDrawPos() + aOffset, attrs );
font->GetLinesAsGlyphs( &m_render_cache, forResolvedText, GetDrawPos() + aOffset,
attrs );
m_render_cache_font = aFont;
m_render_cache_angle = resolvedAngle;
m_render_cache_text = forResolvedText;
m_render_cache_offset = aOffset;
@@ -514,7 +535,7 @@ BOX2I EDA_TEXT::GetTextBox( int aLine, bool aInvertY ) const
BOX2I bbox;
wxArrayString strings;
wxString text = GetShownText();
wxString text = GetShownText( true );
int thickness = GetEffectiveTextPenWidth();
if( IsMultilineAllowed() )
@@ -542,12 +563,16 @@ BOX2I EDA_TEXT::GetTextBox( int aLine, bool aInvertY ) const
// bounding box will be moved later according to the actual text options
wxSize textsize = wxSize( extents.x, extents.y );
VECTOR2I pos = drawPos;
int fudgeFactor = extents.y * 0.17;
if( font->IsStroke() )
textsize.y += fudgeFactor;
if( IsMultilineAllowed() && aLine > 0 && aLine < (int) strings.GetCount() )
pos.y -= KiROUND( aLine * font->GetInterline( fontSize.y ) );
if( text.Contains( wxT( "~{" ) ) )
overbarOffset = extents.y / 14;
overbarOffset = extents.y / 6;
if( aInvertY )
pos.y = -pos.y;
@@ -555,7 +580,7 @@ BOX2I EDA_TEXT::GetTextBox( int aLine, bool aInvertY ) const
bbox.SetOrigin( pos );
// for multiline texts and aLine < 0, merge all rectangles (aLine == -1 signals all lines)
if( IsMultilineAllowed() && aLine < 0 && strings.GetCount() )
if( IsMultilineAllowed() && aLine < 0 && strings.GetCount() > 1 )
{
for( unsigned ii = 1; ii < strings.GetCount(); ii++ )
{
@@ -569,6 +594,8 @@ BOX2I EDA_TEXT::GetTextBox( int aLine, bool aInvertY ) const
textsize.y += KiROUND( ( strings.GetCount() - 1 ) * font->GetInterline( fontSize.y ) );
}
textsize.y += overbarOffset;
bbox.SetSize( textsize );
/*
@@ -597,14 +624,16 @@ BOX2I EDA_TEXT::GetTextBox( int aLine, bool aInvertY ) const
switch( GetVertJustify() )
{
case GR_TEXT_V_ALIGN_TOP:
bbox.Offset( 0, -fudgeFactor );
break;
case GR_TEXT_V_ALIGN_CENTER:
bbox.SetY( bbox.GetY() - ( bbox.GetHeight() + overbarOffset ) / 2 );
bbox.SetY( bbox.GetY() - bbox.GetHeight() / 2 );
break;
case GR_TEXT_V_ALIGN_BOTTOM:
bbox.SetY( bbox.GetY() - ( bbox.GetHeight() + overbarOffset ) );
bbox.SetY( bbox.GetY() - bbox.GetHeight() );
bbox.Offset( 0, fudgeFactor );
break;
}
@@ -652,7 +681,7 @@ void EDA_TEXT::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset,
{
std::vector<VECTOR2I> positions;
wxArrayString strings;
wxStringSplit( GetShownText(), strings, '\n' );
wxStringSplit( GetShownText( true ), strings, '\n' );
positions.reserve( strings.Count() );
@@ -663,7 +692,8 @@ void EDA_TEXT::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset,
}
else
{
printOneLineOfText( aSettings, aOffset, aColor, aFillMode, GetShownText(), GetDrawPos() );
printOneLineOfText( aSettings, aOffset, aColor, aFillMode, GetShownText( true ),
GetDrawPos() );
}
}
@@ -857,12 +887,23 @@ std::shared_ptr<SHAPE_COMPOUND> EDA_TEXT::GetEffectiveTextShape( bool aTriangula
KIGFX::GAL_DISPLAY_OPTIONS empty_opts;
KIFONT::FONT* font = getDrawFont();
int penWidth = GetEffectiveTextPenWidth();
wxString shownText( GetShownText( true ) );
VECTOR2I drawPos = GetDrawPos();
TEXT_ATTRIBUTES attrs = GetAttributes();
std::vector<std::unique_ptr<KIFONT::GLYPH>>* cache = nullptr;
if( aUseTextRotation )
{
attrs.m_Angle = GetDrawRotation();
if( font->IsOutline() )
cache = GetRenderCache( font, shownText, drawPos );
}
else
{
attrs.m_Angle = ANGLE_0;
}
if( aTriangulate )
{
@@ -884,7 +925,10 @@ std::shared_ptr<SHAPE_COMPOUND> EDA_TEXT::GetEffectiveTextShape( bool aTriangula
shape->AddShape( triShape );
} );
font->Draw( &callback_gal, GetShownText(), GetDrawPos(), attrs );
if( cache )
callback_gal.DrawGlyphs( *cache );
else
font->Draw( &callback_gal, shownText, drawPos, attrs );
}
else
{
@@ -901,7 +945,10 @@ std::shared_ptr<SHAPE_COMPOUND> EDA_TEXT::GetEffectiveTextShape( bool aTriangula
shape->AddShape( aPoly.Clone() );
} );
font->Draw( &callback_gal, GetShownText(), GetDrawPos(), attrs );
if( cache )
callback_gal.DrawGlyphs( *cache );
else
font->Draw( &callback_gal, shownText, drawPos, attrs );
}
return shape;
@@ -942,41 +989,6 @@ int EDA_TEXT::Compare( const EDA_TEXT* aOther ) const
}
void EDA_TEXT::TransformBoundingBoxToPolygon( SHAPE_POLY_SET* aBuffer, int aClearance ) const
{
if( GetText().Length() == 0 )
return;
VECTOR2I corners[4]; // Buffer of polygon corners
BOX2I rect = GetTextBox();
// TrueType bounding boxes aren't guaranteed to include all descenders, diacriticals, etc.
// Since we use this for zone knockouts and DRC, we need something more accurate.
if( getDrawFont()->IsOutline() )
rect = GetEffectiveTextShape( false, false )->BBox();
rect.Inflate( aClearance );
corners[0].x = rect.GetOrigin().x;
corners[0].y = rect.GetOrigin().y;
corners[1].y = corners[0].y;
corners[1].x = rect.GetRight();
corners[2].x = corners[1].x;
corners[2].y = rect.GetBottom();
corners[3].y = corners[2].y;
corners[3].x = corners[0].x;
aBuffer->NewOutline();
for( VECTOR2I& corner : corners )
{
RotatePoint( corner, GetDrawPos(), GetDrawRotation() );
aBuffer->Append( corner.x, corner.y );
}
}
bool EDA_TEXT::ValidateHyperlink( const wxString& aURL )
{
if( aURL.IsEmpty() || IsGotoPageHref( aURL ) )
+11 -3
View File
@@ -120,10 +120,18 @@ FUTURE_FORMAT_ERROR::FUTURE_FORMAT_ERROR( const PARSE_ERROR& aParseError,
const wxString& aRequiredVersion ) :
PARSE_ERROR()
{
init( aRequiredVersion );
if( const FUTURE_FORMAT_ERROR* ffe = dynamic_cast<const FUTURE_FORMAT_ERROR*>( &aParseError ) )
{
requiredVersion = ffe->requiredVersion;
problem = ffe->Problem();
}
else
{
init( aRequiredVersion );
if( !aParseError.Problem().IsEmpty() )
problem += wxS( "\n\n" ) + _( "Full error text:" ) + wxS( "\n" ) + aParseError.Problem();
if( !aParseError.Problem().IsEmpty() )
problem += wxS( "\n\n" ) + _( "Full error text:" ) + wxS( "\n" ) + aParseError.Problem();
}
lineNumber = aParseError.lineNumber;
byteIndex = aParseError.byteIndex;
+136 -39
View File
@@ -2,7 +2,7 @@
* This program source code file is part of KICAD, a free EDA CAD application.
*
* Copyright (C) 2021 Ola Rinta-Koski
* Copyright (C) 2021-2022 Kicad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2021-2023 Kicad Developers, see AUTHORS.txt for contributors.
*
* Font abstract base class
*
@@ -35,6 +35,7 @@
// The "official" name of the building Kicad stroke font (always existing)
#include <font/kicad_font_name.h>
#include "macros.h"
#include "wx/tokenzr.h"
// markup_parser.h includes pegtl.hpp which includes windows.h... which leaks #define DrawText
@@ -120,6 +121,13 @@ void FONT::getLinePositions( const wxString& aText, const VECTOR2I& aPosition,
VECTOR2I offset( 0, 0 );
offset.y += aAttrs.m_Size.y;
if( IsStroke() )
{
// Fudge factors to match 6.0 positioning
offset.x += aAttrs.m_StrokeWidth / 1.52;
offset.y -= aAttrs.m_StrokeWidth * 0.052;
}
switch( aAttrs.m_Valign )
{
case GR_TEXT_V_ALIGN_TOP: break;
@@ -138,7 +146,7 @@ void FONT::getLinePositions( const wxString& aText, const VECTOR2I& aPosition,
{
case GR_TEXT_H_ALIGN_LEFT: break;
case GR_TEXT_H_ALIGN_CENTER: lineOffset.x = -lineSize.x / 2; break;
case GR_TEXT_H_ALIGN_RIGHT: lineOffset.x = -lineSize.x; break;
case GR_TEXT_H_ALIGN_RIGHT: lineOffset.x = -( lineSize.x + offset.x ); break;
}
aPositions.push_back( aPosition + lineOffset );
@@ -191,6 +199,8 @@ VECTOR2I drawMarkup( BOX2I* aBoundingBox, std::vector<std::unique_ptr<GLYPH>>* a
bool aMirror, const VECTOR2I& aOrigin, TEXT_STYLE_FLAGS aTextStyle )
{
VECTOR2I nextPosition = aPosition;
bool drawUnderline = false;
bool drawOverbar = false;
if( aNode )
{
@@ -199,30 +209,79 @@ VECTOR2I drawMarkup( BOX2I* aBoundingBox, std::vector<std::unique_ptr<GLYPH>>* a
if( !aNode->is_root() )
{
if( aNode->isSubscript() )
textStyle = TEXT_STYLE::SUBSCRIPT;
textStyle |= TEXT_STYLE::SUBSCRIPT;
else if( aNode->isSuperscript() )
textStyle = TEXT_STYLE::SUPERSCRIPT;
textStyle |= TEXT_STYLE::SUPERSCRIPT;
if( aNode->isOverbar() )
textStyle |= TEXT_STYLE::OVERBAR;
drawOverbar = true;
if( aNode->has_content() )
{
BOX2I bbox;
nextPosition = aFont->GetTextAsGlyphs( &bbox, aGlyphs, aNode->asWxString(), aSize,
aPosition, aAngle, aMirror, aOrigin,
nextPosition, aAngle, aMirror, aOrigin,
textStyle );
if( aBoundingBox )
aBoundingBox->Merge( bbox );
}
}
else if( aTextStyle & TEXT_STYLE::UNDERLINE )
{
drawUnderline = true;
}
for( const std::unique_ptr<MARKUP::NODE>& child : aNode->children )
{
nextPosition = drawMarkup( aBoundingBox, aGlyphs, child, nextPosition, aFont, aSize,
aAngle, aMirror, aOrigin, textStyle );
aAngle, aMirror, aOrigin, textStyle );
}
}
if( drawUnderline )
{
// Shorten the bar a little so its rounded ends don't make it over-long
double barTrim = aSize.x * 0.1;
double barOffset = aFont->ComputeUnderlineVerticalPosition( aSize.y );
VECTOR2D barStart( aPosition.x + barTrim, aPosition.y - barOffset );
VECTOR2D barEnd( nextPosition.x - barTrim, nextPosition.y - barOffset );
if( aGlyphs )
{
STROKE_GLYPH barGlyph;
barGlyph.AddPoint( barStart );
barGlyph.AddPoint( barEnd );
barGlyph.Finalize();
aGlyphs->push_back( barGlyph.Transform( { 1.0, 1.0 }, { 0, 0 }, false, aAngle, aMirror,
aOrigin ) );
}
}
if( drawOverbar )
{
// Shorten the bar a little so its rounded ends don't make it over-long
double barTrim = aSize.x * 0.1;
double barOffset = aFont->ComputeOverbarVerticalPosition( aSize.y );
VECTOR2D barStart( aPosition.x + barTrim, aPosition.y - barOffset );
VECTOR2D barEnd( nextPosition.x - barTrim, nextPosition.y - barOffset );
if( aGlyphs )
{
STROKE_GLYPH barGlyph;
barGlyph.AddPoint( barStart );
barGlyph.AddPoint( barEnd );
barGlyph.Finalize();
aGlyphs->push_back( barGlyph.Transform( { 1.0, 1.0 }, { 0, 0 }, false, aAngle, aMirror,
aOrigin ) );
}
}
@@ -253,6 +312,7 @@ void FONT::drawSingleLineText( KIGFX::GAL* aGal, BOX2I* aBoundingBox, const wxSt
TEXT_STYLE_FLAGS textStyle = 0;
if( aItalic )
textStyle |= TEXT_STYLE::ITALIC;
@@ -281,13 +341,13 @@ VECTOR2I FONT::StringBoundaryLimits( const wxString& aText, const VECTOR2I& aSiz
if( aItalic )
textStyle |= TEXT_STYLE::ITALIC;
(void) drawMarkup( &boundingBox, nullptr, aText, VECTOR2I(), aSize, ANGLE_0, false,
VECTOR2I(), textStyle );
(void) drawMarkup( &boundingBox, nullptr, aText, VECTOR2I(), aSize, ANGLE_0, false, VECTOR2I(),
textStyle );
if( IsStroke() )
{
// Inflate by a bit more than thickness/2 to catch diacriticals, descenders, etc.
boundingBox.Inflate( KiROUND( aThickness * 1.25 ) );
boundingBox.Inflate( KiROUND( aThickness * 1.5 ) );
}
else if( IsOutline() )
{
@@ -308,7 +368,7 @@ VECTOR2I FONT::boundingBoxSingleLine( BOX2I* aBBox, const wxString& aText,
textStyle |= TEXT_STYLE::ITALIC;
VECTOR2I extents = drawMarkup( aBBox, nullptr, aText, aPosition, aSize, ANGLE_0, false,
VECTOR2I(), textStyle );
VECTOR2I(), textStyle );
return extents;
}
@@ -376,20 +436,22 @@ void wordbreakMarkup( std::vector<std::pair<wxString, int>>* aWords,
}
else
{
wxString textRun = aNode->asWxString();
wxArrayString words;
wxString textRun = aNode->asWxString();
wxStringTokenizer tokenizer( textRun, " ", wxTOKEN_RET_DELIMS );
std::vector<wxString> words;
wxStringSplit( textRun, words, ' ' );
while( tokenizer.HasMoreTokens() )
words.emplace_back( tokenizer.GetNextToken() );
if( textRun.EndsWith( wxS( " " ) ) )
words.Add( wxS( " " ) );
for( size_t ii = 0; ii < words.size(); ++ii )
for( const wxString& word : words )
{
int w = aFont->GetTextAsGlyphs( nullptr, nullptr, words[ii], aSize, { 0, 0 },
wxString chars = word;
chars.Trim();
int w = aFont->GetTextAsGlyphs( nullptr, nullptr, chars, aSize, { 0, 0 },
ANGLE_0, false, { 0, 0 }, textStyle ).x;
aWords->emplace_back( std::make_pair( words[ii], w ) );
aWords->emplace_back( std::make_pair( word, w ) );
}
}
}
@@ -441,35 +503,70 @@ void FONT::LinebreakText( wxString& aText, int aColumnWidth, const VECTOR2I& aSi
for( size_t ii = 0; ii < textLines.Count(); ++ii )
{
bool virginLine = true;
int lineWidth = 0;
std::vector<std::pair<wxString, int>> markup;
std::vector<std::pair<wxString, int>> words;
wordbreakMarkup( &words, textLines[ii], aSize, textStyle );
wordbreakMarkup( &markup, textLines[ii], aSize, textStyle );
for( size_t jj = 0; jj < words.size(); /* advance in loop */ )
for( const auto& [ run, runWidth ] : markup )
{
if( virginLine )
if( !words.empty() && !words.back().first.EndsWith( ' ' ) )
{
// First word is always placed, even when wider than columnWidth.
aText += words[jj].first;
lineWidth += words[jj].second;
jj++;
virginLine = false;
}
else if( lineWidth + spaceWidth + words[jj].second < aColumnWidth - aThickness )
{
aText += " " + words[jj].first;
lineWidth += spaceWidth + words[jj].second;
jj++;
words.back().first += run;
words.back().second += runWidth;
}
else
{
aText += '\n';
words.emplace_back( std::make_pair( run, runWidth ) );
}
}
bool buryMode = false;
int lineWidth = 0;
wxString pendingSpaces;
for( const auto& [ word, wordWidth ] : words )
{
int pendingSpaceWidth = (int) pendingSpaces.Length() * spaceWidth;
bool overflow = lineWidth + pendingSpaceWidth + wordWidth > aColumnWidth - aThickness;
if( overflow && pendingSpaces.Length() > 0 )
{
aText += '\n';
lineWidth = 0;
virginLine = true;
pendingSpaces = wxEmptyString;
pendingSpaceWidth = 0;
buryMode = true;
}
if( word == wxS( " " ) )
{
pendingSpaces += word;
}
else
{
if( buryMode )
{
buryMode = false;
}
else
{
aText += pendingSpaces;
lineWidth += pendingSpaceWidth;
}
if( word.EndsWith( ' ' ) )
{
aText += word.Left( word.Length() - 1 );
pendingSpaces = wxS( " " );
}
else
{
aText += word;
pendingSpaces = wxEmptyString;
}
lineWidth += wordWidth;
}
}
+15 -98
View File
@@ -2,7 +2,7 @@
* This program source code file is part of KICAD, a free EDA CAD application.
*
* Copyright (C) 2021 Ola Rinta-Koski <gitlab@rinta-koski.net>
* Copyright (C) 2021-2022 Kicad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2021-2023 Kicad Developers, see AUTHORS.txt for contributors.
*
* Outline font class
*
@@ -313,22 +313,6 @@ VECTOR2I OUTLINE_FONT::GetTextAsGlyphs( BOX2I* aBBox, std::vector<std::unique_pt
}
double OUTLINE_FONT::getOverbarOffset( int ascender, int height, int thickness ) const
{
double thicknessRatio = abs( (double) thickness ) / (double) height;
double ascenderRatio = (double) ascender / (double) height;
if( thicknessRatio < 0.05 )
return 0.04;
else if( ascenderRatio < 0.78 )
return 0.00;
else if( ascenderRatio < 0.80 )
return -0.03;
else
return -0.06;
}
VECTOR2I OUTLINE_FONT::getTextAsGlyphs( BOX2I* aBBox, std::vector<std::unique_ptr<GLYPH>>* aGlyphs,
const wxString& aText, const VECTOR2I& aSize,
const VECTOR2I& aPosition, const EDA_ANGLE& aAngle,
@@ -338,14 +322,15 @@ VECTOR2I OUTLINE_FONT::getTextAsGlyphs( BOX2I* aBBox, std::vector<std::unique_pt
std::lock_guard<std::mutex> guard( m_freeTypeMutex );
return getTextAsGlyphsUnlocked( aBBox, aGlyphs, aText, aSize, aPosition, aAngle, aMirror,
aOrigin, aTextStyle );
aOrigin, aTextStyle );
}
VECTOR2I OUTLINE_FONT::getTextAsGlyphsUnlocked( BOX2I* aBBox, std::vector<std::unique_ptr<GLYPH>>* aGlyphs,
const wxString& aText, const VECTOR2I& aSize,
const VECTOR2I& aPosition, const EDA_ANGLE& aAngle,
bool aMirror, const VECTOR2I& aOrigin,
TEXT_STYLE_FLAGS aTextStyle ) const
VECTOR2I OUTLINE_FONT::getTextAsGlyphsUnlocked( BOX2I* aBBox,
std::vector<std::unique_ptr<GLYPH>>* aGlyphs,
const wxString& aText, const VECTOR2I& aSize,
const VECTOR2I& aPosition, const EDA_ANGLE& aAngle,
bool aMirror, const VECTOR2I& aOrigin,
TEXT_STYLE_FLAGS aTextStyle ) const
{
VECTOR2D glyphSize = aSize;
FT_Face face = m_face;
@@ -377,6 +362,9 @@ VECTOR2I OUTLINE_FONT::getTextAsGlyphsUnlocked( BOX2I* aBBox, std::vector<std::u
VECTOR2I cursor( 0, 0 );
if( aGlyphs )
aGlyphs->reserve( glyphCount );
for( unsigned int i = 0; i < glyphCount; i++ )
{
// Don't process glyphs that were already included in a previous cluster
@@ -395,7 +383,7 @@ VECTOR2I OUTLINE_FONT::getTextAsGlyphsUnlocked( BOX2I* aBBox, std::vector<std::u
matrix.yx = (FT_Fixed) ( 0 * 0x10000L ); // Don't rotate in the y direction
matrix.yy = (FT_Fixed) ( 1 * 0x10000L );
FT_Set_Transform(face, &matrix,0);
FT_Set_Transform( face, &matrix, 0 );
}
FT_Load_Glyph( face, glyphInfo[i].codepoint, FT_LOAD_NO_BITMAP );
@@ -418,6 +406,8 @@ VECTOR2I OUTLINE_FONT::getTextAsGlyphsUnlocked( BOX2I* aBBox, std::vector<std::u
GLYPH_POINTS points = c.m_Points;
SHAPE_LINE_CHAIN shape;
shape.ReservePoints( points.size() );
for( const VECTOR2D& v : points )
{
VECTOR2D pt( v + cursor );
@@ -462,13 +452,6 @@ VECTOR2I OUTLINE_FONT::getTextAsGlyphsUnlocked( BOX2I* aBBox, std::vector<std::u
}
}
// FONT TODO we might not want to do Fracture() here;
// knockout text (eg. silkscreen labels with a background) will
// need to do that after the contours have been turned into holes
// and vice versa
if( glyph->HasHoles() )
glyph->Fracture( SHAPE_POLY_SET::PM_FAST ); // FONT TODO verify aFastMode
aGlyphs->push_back( std::move( glyph ) );
}
@@ -478,75 +461,9 @@ VECTOR2I OUTLINE_FONT::getTextAsGlyphsUnlocked( BOX2I* aBBox, std::vector<std::u
}
int ascender = abs( face->size->metrics.ascender * GLYPH_SIZE_SCALER );
int height = abs( face->size->metrics.height * GLYPH_SIZE_SCALER );
int descender = abs( face->size->metrics.descender * GLYPH_SIZE_SCALER );
VECTOR2I extents( cursor.x * scaleFactor.x, ( ascender + descender ) * abs( scaleFactor.y ) );
// Font metrics don't include all descenders and diacriticals, so beef them up just a little.
extents.y *= 1.05;
if( IsOverbar( aTextStyle ) )
{
std::vector<std::unique_ptr<GLYPH>> underscoreGlyphs;
getTextAsGlyphsUnlocked( nullptr, &underscoreGlyphs, wxT( "_" ), aSize, { 0, 0 }, ANGLE_0, false,
{ 0, 0 }, aTextStyle & ~TEXT_STYLE::OVERBAR );
OUTLINE_GLYPH* underscoreGlyph = static_cast<OUTLINE_GLYPH*>( underscoreGlyphs[0].get() );
BOX2I underscoreBBox;
for( const VECTOR2I& pt : underscoreGlyph->Outline( 0 ).CPoints() )
underscoreBBox.Merge( pt );
int barThickness = underscoreBBox.GetHeight();
// Shorten the bar a little so its rounded ends don't make it over-long
double barTrim = barThickness / 2.0;
double barOffset = getOverbarOffset( ascender, height, barThickness / scaleFactor.y );
VECTOR2I topLeft( aPosition );
VECTOR2I topRight( aPosition );
topLeft.y += ascender * scaleFactor.y * ( 1.0 + barOffset );
topRight.y = topLeft.y;
topLeft.x += barTrim;
topRight.x += extents.x - barTrim;
extents.y *= ( 1.0 + barOffset + barOffset );
extents.x += barTrim;
if( IsItalic() )
{
topLeft.x += aSize.y * ITALIC_TILT;
topRight.x += aSize.y * ITALIC_TILT;
extents.x += aSize.y * ITALIC_TILT;
}
if( aMirror )
{
topLeft.x = aOrigin.x - ( topLeft.x - aOrigin.x );
topRight.x = aOrigin.x - ( topRight.x - aOrigin.x );
}
if( !aAngle.IsZero() )
{
RotatePoint( topLeft, aOrigin, aAngle );
RotatePoint( topRight, aOrigin, aAngle );
}
if( aGlyphs )
{
int maxError = KiROUND( barThickness / 48 );
SHAPE_POLY_SET poly;
TransformOvalToPolygon( poly, topLeft, topRight, barThickness, maxError, ERROR_INSIDE );
std::unique_ptr<OUTLINE_GLYPH> overbarGlyph = std::make_unique<OUTLINE_GLYPH>( poly );
aGlyphs->push_back( std::move( overbarGlyph ) );
}
}
hb_buffer_destroy( buf );
hb_font_destroy( referencedFont );
@@ -575,7 +492,7 @@ void OUTLINE_FONT::RenderToOpenGLCanvas( KIGFX::OPENGL_GAL& aGal, const wxString
unsigned int glyphCount;
hb_glyph_info_t* glyphInfo = hb_buffer_get_glyph_infos( buf, &glyphCount );
hb_glyph_position_t* glyphPos = hb_buffer_get_glyph_positions( buf, &glyphCount );
std::lock_guard<std::mutex> guard( m_freeTypeMutex );
hb_font_t* referencedFont = hb_ft_font_create_referenced( m_face );
+6 -62
View File
@@ -4,7 +4,7 @@
* Copyright (C) 2012 Torsten Hueter, torstenhtr <at> gmx.de
* Copyright (C) 2013 CERN
* @author Maciej Suminski <maciej.suminski@cern.ch>
* Copyright (C) 2016-2022 Kicad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2016-2023 Kicad Developers, see AUTHORS.txt for contributors.
*
* Stroke font class
*
@@ -44,7 +44,7 @@ using namespace KIFONT;
///< Factor that determines relative vertical position of the overbar.
static constexpr double OVERBAR_POSITION_FACTOR = 1.40;
static constexpr double OVERBAR_POSITION_FACTOR = 1.23;
///< Factor that determines relative vertical position of the underline.
static constexpr double UNDERLINE_POSITION_FACTOR = -0.16;
@@ -128,7 +128,6 @@ void STROKE_FONT::loadNewStrokeFont( const char* const aNewStrokeFont[], int aNe
while( aNewStrokeFont[j][i] )
{
if( aNewStrokeFont[j][i] == ' ' && aNewStrokeFont[j][i+1] == 'R' )
strokes++;
@@ -228,9 +227,9 @@ VECTOR2I STROKE_FONT::GetTextAsGlyphs( BOX2I* aBBox, std::vector<std::unique_ptr
{
constexpr int TAB_WIDTH = 4;
constexpr double INTER_CHAR = 0.2;
constexpr double SUPER_SUB_SIZE_MULTIPLIER = 0.7;
constexpr double SUPER_HEIGHT_OFFSET = 0.5;
constexpr double SUB_HEIGHT_OFFSET = 0.3;
constexpr double SUPER_SUB_SIZE_MULTIPLIER = 0.8;
constexpr double SUPER_HEIGHT_OFFSET = 0.35;
constexpr double SUB_HEIGHT_OFFSET = 0.15;
VECTOR2I cursor( aPosition );
VECTOR2D glyphSize( aSize );
@@ -295,71 +294,16 @@ VECTOR2I STROKE_FONT::GetTextAsGlyphs( BOX2I* aBBox, std::vector<std::unique_ptr
glyphExtents *= glyphSize;
if( tilt > 0.0 )
glyphExtents.x -= glyphExtents.y * tilt;
cursor.x += KiROUND( glyphExtents.x );
}
++char_count;
}
VECTOR2D barOffset( 0.0, 0.0 );
// Shorten the bar a little so its rounded ends don't make it over-long
double barTrim = glyphSize.x * 0.1;
if( aTextStyle & TEXT_STYLE::OVERBAR )
{
barOffset.y = ComputeOverbarVerticalPosition( glyphSize.y );
if( aTextStyle & TEXT_STYLE::ITALIC )
barOffset.x = barOffset.y * ITALIC_TILT;
VECTOR2D barStart( aPosition.x + barOffset.x + barTrim, cursor.y - barOffset.y );
VECTOR2D barEnd( cursor.x + barOffset.x - barTrim, cursor.y - barOffset.y );
if( aGlyphs )
{
STROKE_GLYPH overbarGlyph;
overbarGlyph.AddPoint( barStart );
overbarGlyph.AddPoint( barEnd );
overbarGlyph.Finalize();
aGlyphs->push_back( overbarGlyph.Transform( { 1.0, 1.0 }, { 0, 0 }, false,
aAngle, aMirror, aOrigin ) );
}
}
if( aTextStyle & TEXT_STYLE::UNDERLINE )
{
barOffset.y = ComputeUnderlineVerticalPosition( glyphSize.y );
if( aTextStyle & TEXT_STYLE::ITALIC )
barOffset.x = barOffset.y * ITALIC_TILT;
VECTOR2D barStart( aPosition.x + barOffset.x + barTrim, cursor.y - barOffset.y );
VECTOR2D barEnd( cursor.x + barOffset.x - barTrim, cursor.y - barOffset.y );
if( aGlyphs )
{
STROKE_GLYPH underlineGlyph;
underlineGlyph.AddPoint( barStart );
underlineGlyph.AddPoint( barEnd );
underlineGlyph.Finalize();
aGlyphs->push_back( underlineGlyph.Transform( { 1.0, 1.0 }, { 0, 0 }, false,
aAngle, aMirror, aOrigin ) );
}
}
if( aBBox )
{
aBBox->SetOrigin( aPosition );
aBBox->SetEnd( cursor.x + barOffset.x - KiROUND( glyphSize.x * INTER_CHAR ),
cursor.y + std::max( glyphSize.y, barOffset.y * OVERBAR_POSITION_FACTOR ) );
aBBox->SetEnd( cursor.x - KiROUND( glyphSize.x * INTER_CHAR ), cursor.y + glyphSize.y );
aBBox->Normalize();
}
+2 -3
View File
@@ -86,12 +86,11 @@ void FOOTPRINT_FILTER_IT::increment()
candidate.GetLibNickname(),
candidate.GetFootprintName(),
candidate.GetSearchText() );
int matches, position;
bool exclude = false;
bool exclude = false;
for( std::unique_ptr<EDA_COMBINED_MATCHER>& matcher : m_filter->m_pattern_filters )
{
if( !matcher->Find( searchStr.Lower(), matches, position ) )
if( !matcher->Find( searchStr.Lower() ) )
{
exclude = true;
break;
+1 -1
View File
@@ -180,7 +180,7 @@ bool COLOR4D::SetFromHexString( const wxString& aColorString )
str.Trim( true );
str.Trim( false );
if( str.length() < 7 || str.GetChar( 0 ) != '#' )
if( str.length() < 7 || !str.StartsWith( '#' ) )
return false;
unsigned long tmp;
+37 -20
View File
@@ -47,6 +47,7 @@
#include <macros.h>
#include <geometry/geometry_utils.h>
#include <thread_pool.h>
#include <profile.h>
#include <trace_helpers.h>
@@ -259,11 +260,17 @@ OPENGL_GAL::OPENGL_GAL( GAL_DISPLAY_OPTIONS& aDisplayOptions, wxWindow* aParent,
{
m_glMainContext = GL_CONTEXT_MANAGER::Get().CreateCtx( this );
if( !m_glMainContext )
throw std::runtime_error( "Could not create the main OpenGL context" );
m_glPrivContext = m_glMainContext;
}
else
{
m_glPrivContext = GL_CONTEXT_MANAGER::Get().CreateCtx( this, m_glMainContext );
if( !m_glPrivContext )
throw std::runtime_error( "Could not create a private OpenGL context" );
}
m_shader = new SHADER();
@@ -1418,21 +1425,23 @@ void OPENGL_GAL::DrawBitmap( const BITMAP_BASE& aBitmap, double alphaBlend )
glActiveTexture( GL_TEXTURE0 );
glBindTexture( GL_TEXTURE_2D, texture_id );
float texStartX = aBitmap.IsMirrored() ? 1.0 : 0.0;
float texEndX = aBitmap.IsMirrored() ? 0.0 : 1.0;
float texStartX = aBitmap.IsMirroredX() ? 1.0 : 0.0;
float texEndX = aBitmap.IsMirroredX() ? 0.0 : 1.0;
float texStartY = aBitmap.IsMirroredY() ? 1.0 : 0.0;
float texEndY = aBitmap.IsMirroredY() ? 0.0 : 1.0;
glBegin( GL_QUADS );
glColor4f( 1.0, 1.0, 1.0, alpha );
glTexCoord2f( texStartX, 0.0 );
glTexCoord2f( texStartX, texStartY );
glVertex3f( v0.x, v0.y, m_layerDepth );
glColor4f( 1.0, 1.0, 1.0, alpha );
glTexCoord2f( texEndX, 0.0 );
glTexCoord2f( texEndX, texStartY);
glVertex3f( v1.x, v0.y, m_layerDepth );
glColor4f( 1.0, 1.0, 1.0, alpha );
glTexCoord2f( texEndX, 1.0 );
glTexCoord2f( texEndX, texEndY);
glVertex3f( v1.x, v1.y, m_layerDepth );
glColor4f( 1.0, 1.0, 1.0, alpha );
glTexCoord2f( texStartX, 1.0 );
glTexCoord2f( texStartX, texEndY);
glVertex3f( v0.x, v1.y, m_layerDepth );
glEnd();
@@ -2530,16 +2539,8 @@ void OPENGL_GAL::init()
#endif /* wxCHECK_VERSION( 3, 0, 3 ) */
// Check correct initialization from the constructor
if( !m_glMainContext )
throw std::runtime_error( "Could not create the main OpenGL context" );
if( !m_glPrivContext )
throw std::runtime_error( "Could not create a private OpenGL context" );
if( m_tesselator == nullptr )
throw std::runtime_error( "Could not create the m_tesselator" );
// End initialization checks
throw std::runtime_error( "Could not create the tesselator" );
GLenum err = glewInit();
if( GLEW_OK != err )
@@ -2779,15 +2780,31 @@ void OPENGL_GAL::DrawGlyphs( const std::vector<std::unique_ptr<KIFONT::GLYPH>>&
// Optimized path for stroke fonts that pre-reserves glyph triangles.
int triangleCount = 0;
if( aGlyphs.size() > 0 )
{
thread_pool& tp = GetKiCadThreadPool();
tp.push_loop( aGlyphs.size(),
[&]( const int a, const int b)
{
for( int ii = a; ii < b; ++ii )
{
auto glyph = static_cast<KIFONT::OUTLINE_GLYPH*>( aGlyphs.at( ii ).get() );
// Only call CacheTriangulation() if it has never been done before.
// Otherwise we'll hash the triangulation to see if it has been edited,
// and all our glpyh editing ops update the triangulation anyway.
if( glyph->TriangulatedPolyCount() == 0 )
glyph->CacheTriangulation( false );
}
} );
tp.wait_for_tasks();
}
for( const std::unique_ptr<KIFONT::GLYPH>& glyph : aGlyphs )
{
const auto& outlineGlyph = static_cast<const KIFONT::OUTLINE_GLYPH&>( *glyph );
// Only call CacheTriangulation if it has never been done before. Otherwise we'll hash
// the triangulation to see if it has been edited, and glyphs after creation are read-only.
if( outlineGlyph.TriangulatedPolyCount() == 0 )
const_cast<KIFONT::OUTLINE_GLYPH&>( outlineGlyph ).CacheTriangulation( false );
for( unsigned int i = 0; i < outlineGlyph.TriangulatedPolyCount(); i++ )
{
const SHAPE_POLY_SET::TRIANGULATED_POLYGON* polygon =
+2 -2
View File
@@ -87,7 +87,7 @@ void GL_CONTEXT_MANAGER::DeleteAll()
void GL_CONTEXT_MANAGER::LockCtx( wxGLContext* aContext, wxGLCanvas* aCanvas )
{
wxCHECK( aCanvas || m_glContexts.count( aContext ) > 0, /* void */ );
wxCHECK( aContext && m_glContexts.count( aContext ) > 0, /* void */ );
m_glCtxMutex.lock();
wxGLCanvas* canvas = aCanvas ? aCanvas : m_glContexts.at( aContext );
@@ -106,7 +106,7 @@ void GL_CONTEXT_MANAGER::LockCtx( wxGLContext* aContext, wxGLCanvas* aCanvas )
void GL_CONTEXT_MANAGER::UnlockCtx( wxGLContext* aContext )
{
wxCHECK( m_glContexts.count( aContext ) > 0, /* void */ );
wxCHECK( aContext && m_glContexts.count( aContext ) > 0, /* void */ );
if( m_glCtx == aContext )
{
+3
View File
@@ -94,7 +94,10 @@ void GRSetColorPen( wxDC* DC, const COLOR4D& Color, int width, wxPenStyle style
// wxWidgets will enforce a minimum pen width when printing, so we have to make the pen
// transparent when we don't want the object stroked.
if( width == 0 )
{
color = COLOR4D::UNSPECIFIED;
style = wxPENSTYLE_TRANSPARENT;
}
const wxPen& curr_pen = DC->GetPen();
+21 -8
View File
@@ -418,9 +418,16 @@ void GRID_TRICKS::onCharHook( wxKeyEvent& ev )
{
bool handled = false;
if( ev.GetKeyCode() == WXK_RETURN && m_grid->GetGridCursorRow() == m_grid->GetNumberRows() - 1 )
if( ( ev.GetKeyCode() == WXK_RETURN || ev.GetKeyCode() == WXK_NUMPAD_ENTER )
&& ev.GetModifiers() == wxMOD_NONE
&& m_grid->GetGridCursorRow() == m_grid->GetNumberRows() - 1 )
{
if( m_grid->CommitPendingChanges() )
if( m_grid->IsCellEditControlShown() )
{
if( m_grid->CommitPendingChanges() )
handled = true;
}
else
{
wxCommandEvent dummy;
m_addHandler( dummy );
@@ -449,6 +456,14 @@ void GRID_TRICKS::onCharHook( wxKeyEvent& ev )
m_grid->ForceRefresh();
}
}
else if( ev.GetKeyCode() == WXK_ESCAPE )
{
if( m_grid->IsCellEditControlShown() )
{
m_grid->CancelPendingChanges();
handled = true;
}
}
if( !handled )
ev.Skip( true );
@@ -711,18 +726,16 @@ void GRID_TRICKS::paste_text( const wxString& cb_text )
wxStringTokenizer cols( rowTxt, COL_SEP, wxTOKEN_RET_EMPTY );
if( !is_selection )
{
end_col = cur_col + cols.CountTokens();
if( end_col > tbl->GetNumberCols() )
end_col = tbl->GetNumberCols();
}
for( int col = start_col; col < end_col; ++col )
for( int col = start_col; col < end_col && col < tbl->GetNumberCols(); ++col )
{
// Skip hidden columns
if( !m_grid->IsColShown( col ) )
{
end_col++;
continue;
}
// If number of selected cols is larger than the count of cols on the clipboard,
// paste again and again until the end of the selection is reached.
+5 -1
View File
@@ -39,6 +39,8 @@ public:
m_includeNetlistAttributes( true ),
m_useX2Format( true ),
m_disableApertureMacros( false ),
m_useAuxOrigin( false ),
m_useProtelFileExtension( true ),
m_precision( 5 ),
m_printMaskLayer()
{
@@ -59,6 +61,8 @@ public:
bool m_includeNetlistAttributes;
bool m_useX2Format;
bool m_disableApertureMacros;
bool m_useAuxOrigin;
bool m_useProtelFileExtension;
int m_precision;
@@ -66,4 +70,4 @@ public:
LSET m_printMaskLayer;
};
#endif
#endif
+5 -1
View File
@@ -33,7 +33,9 @@ public:
m_filename(),
m_outputFile(),
m_colorTheme(),
m_mirror( false ),
m_blackAndWhite( false ),
m_negative( false ),
m_plotFootprintValues( true ),
m_plotRefDes( true ),
m_plotBorderTitleBlocks( false ),
@@ -45,7 +47,9 @@ public:
wxString m_outputFile;
wxString m_colorTheme;
bool m_mirror;
bool m_blackAndWhite;
bool m_negative;
bool m_plotFootprintValues;
bool m_plotRefDes;
bool m_plotBorderTitleBlocks;
@@ -53,4 +57,4 @@ public:
LSET m_printMaskLayer;
};
#endif
#endif
+3 -1
View File
@@ -30,7 +30,8 @@ class JOB_EXPORT_PCB_SVG : public JOB
public:
JOB_EXPORT_PCB_SVG( bool aIsCli ) :
JOB( "svg", aIsCli ), m_filename(), m_outputFile(), m_colorTheme(), m_mirror( false ),
m_blackAndWhite( false ), m_plotDrawingSheet( true ), m_pageSizeMode( 0 ), m_printMaskLayer()
m_blackAndWhite( false ), m_negative( false ), m_plotDrawingSheet( true ),
m_pageSizeMode( 0 ), m_printMaskLayer()
{
}
@@ -40,6 +41,7 @@ public:
bool m_mirror;
bool m_blackAndWhite;
bool m_negative;
bool m_plotDrawingSheet;
int m_pageSizeMode;
-49
View File
@@ -1,49 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2022 Mark Roszko <mark.roszko@gmail.com>
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef JOB_EXPORT_SCH_PDF_H
#define JOB_EXPORT_SCH_PDF_H
#include <wx/string.h>
#include "job.h"
class JOB_EXPORT_SCH_PDF : public JOB
{
public:
JOB_EXPORT_SCH_PDF( bool aIsCli ) :
JOB( "pdf", aIsCli ),
m_filename(),
m_outputFile(),
m_blackAndWhite( false ),
m_useBackgroundColor( false ),
m_plotDrawingSheet( false )
{
}
wxString m_filename;
wxString m_outputFile;
wxString m_colorTheme;
bool m_blackAndWhite;
bool m_useBackgroundColor;
bool m_plotDrawingSheet;
};
#endif
@@ -18,21 +18,24 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef COMMAND_EXPORT_SCH_SVG_H
#define COMMAND_EXPORT_SCH_SVG_H
#ifndef JOB_EXPORT_SCH_PLOT_H
#define JOB_EXPORT_SCH_PLOT_H
#include "command_export_pcb_base.h"
#include <wx/string.h>
#include <plotters/plotter.h>
#include "job.h"
namespace CLI
{
class EXPORT_SCH_SVG_COMMAND : public EXPORT_PCB_BASE_COMMAND
class JOB_EXPORT_SCH_PLOT : public JOB
{
public:
EXPORT_SCH_SVG_COMMAND();
JOB_EXPORT_SCH_PLOT( bool aIsCli, PLOT_FORMAT aPlotFormat, wxString aFilename ) :
JOB( "plot", aIsCli ), m_plotFormat( aPlotFormat ), m_filename( aFilename )
{
}
protected:
int doPerform( KIWAY& aKiway ) override;
PLOT_FORMAT m_plotFormat;
wxString m_filename;
SCH_PLOT_SETTINGS settings;
};
} // namespace CLI
#endif
-49
View File
@@ -1,49 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2022 Mark Roszko <mark.roszko@gmail.com>
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef JOB_EXPORT_SCH_SVG_H
#define JOB_EXPORT_SCH_SVG_H
#include <wx/string.h>
#include "job.h"
class JOB_EXPORT_SCH_SVG : public JOB
{
public:
JOB_EXPORT_SCH_SVG( bool aIsCli ) :
JOB( "svg", aIsCli ),
m_filename(),
m_outputDirectory(),
m_blackAndWhite( false ),
m_useBackgroundColor( false ),
m_plotDrawingSheet( false )
{
}
wxString m_filename;
wxString m_outputDirectory;
wxString m_colorTheme;
bool m_blackAndWhite;
bool m_useBackgroundColor;
bool m_plotDrawingSheet;
};
#endif
+3 -91
View File
@@ -27,109 +27,21 @@
// conflicts for some defines, at least on Windows
#include <kicad_curl/kicad_curl.h>
#include <mutex>
#include <ki_exception.h> // THROW_IO_ERROR
// These are even more private than class members, and since there is only
// one instance of KICAD_CURL ever, these statics are hidden here to simplify the
// client (API) header file.
static volatile bool s_initialized;
static std::mutex s_lock; // for s_initialized
/// At process termination, using atexit() keeps the CURL stuff out of the
/// singletops and PGM_BASE.
static void at_terminate()
{
KICAD_CURL::Cleanup();
}
void KICAD_CURL::Init()
{
// We test s_initialized twice in an effort to avoid
// unnecessarily locking s_lock. This understands that the common case
// will not need to lock.
if( !s_initialized )
if( curl_global_init( CURL_GLOBAL_ALL ) != CURLE_OK )
{
std::lock_guard<std::mutex> lock( s_lock );
if( !s_initialized )
{
if( curl_global_init( CURL_GLOBAL_ALL ) != CURLE_OK )
{
THROW_IO_ERROR( "curl_global_init() failed." );
}
s_initialized = true;
}
THROW_IO_ERROR( "curl_global_init() failed." );
}
}
void KICAD_CURL::Cleanup()
{
/*
Calling lock_guard() from a static destructor will typically be bad, since the
s_lock may already have been statically destroyed itself leading to a boost
exception. (Remember C++ does not provide certain sequencing of static
destructor invocation.)
To prevent this we test s_initialized twice, which ensures that the lock_guard
is only instantiated on the first call, which should be from
PGM_BASE::destroy() which is first called earlier than static destruction.
Then when called again from the actual PGM_BASE::~PGM_BASE() function,
lock_guard will not be instantiated because s_initialized will be false.
*/
if( s_initialized )
{
std::lock_guard<std::mutex> lock( s_lock );
if( s_initialized )
{
curl_global_cleanup();
atexit( &at_terminate );
s_initialized = false;
}
}
}
std::string KICAD_CURL::GetSimpleVersion()
{
if( !s_initialized )
Init();
curl_version_info_data* info = curl_version_info( CURLVERSION_NOW );
std::string res;
if( info->version )
{
res += "libcurl version: " + std::string( info->version );
}
res += " (";
if( info->features & CURL_VERSION_SSL )
{
res += "with SSL - ";
res += std::string( info->ssl_version );
}
else
{
res += "without SSL";
}
res += ")";
return res;
curl_global_cleanup();
}
-6
View File
@@ -112,12 +112,6 @@ static int progressinfo( void* aProgress, double aDLtotal, double aDLnow, double
KICAD_CURL_EASY::KICAD_CURL_EASY() :
m_headers( nullptr )
{
// Call KICAD_CURL::Init() from in here every time, but only the first time
// will incur any overhead. This strategy ensures that libcurl is never loaded
// unless it is needed.
KICAD_CURL::Init();
m_CURL = curl_easy_init();
if( !m_CURL )
+71 -19
View File
@@ -45,6 +45,10 @@
#include <wx/utils.h>
#include <confirm.h>
#ifdef KICAD_USE_SENTRY
#include <sentry.h>
#endif
KIFACE* KIWAY::m_kiface[KIWAY_FACE_COUNT];
int KIWAY::m_kiface_version[KIWAY_FACE_COUNT];
@@ -212,8 +216,6 @@ KIFACE* KIWAY::KiFACE( FACE_T aFaceId, bool doLoad )
if( m_kiface[aFaceId] )
return m_kiface[aFaceId];
wxString msg;
// DSO with KIFACE has not been loaded yet, does caller want to load it?
if( doLoad )
{
@@ -236,6 +238,7 @@ KIFACE* KIWAY::KiFACE( FACE_T aFaceId, bool doLoad )
bool codeSignOk = KIPLATFORM::ENV::VerifyFileSignature( dname );
if( !codeSignOk )
{
wxString msg;
msg.Printf( _( "Failed to verify kiface library '%s' signature." ), dname );
THROW_IO_ERROR( msg );
}
@@ -257,6 +260,14 @@ KIFACE* KIWAY::KiFACE( FACE_T aFaceId, bool doLoad )
setlocale( lc_new_type, user_locale.c_str() );
wxString msg = wxString::Format( "Loading kiface %d", aFaceId );
#ifdef KICAD_USE_SENTRY
sentry_value_t crumb = sentry_value_new_breadcrumb( "navigation", msg.utf8_str() );
sentry_value_set_by_key( crumb, "category", sentry_value_new_string( "kiway.kiface" ) );
sentry_value_set_by_key( crumb, "level", sentry_value_new_string( "info" ) );
sentry_add_breadcrumb( crumb );
#endif
if( !success )
{
// Failure: error reporting UI was done via wxLogSysError().
@@ -287,15 +298,38 @@ KIFACE* KIWAY::KiFACE( FACE_T aFaceId, bool doLoad )
wxASSERT_MSG( kiface,
wxT( "attempted DSO has a bug, failed to return a KIFACE*" ) );
wxDllType dsoHandle = dso.Detach();
bool startSuccess = false;
// Give the DSO a single chance to do its "process level" initialization.
// "Process level" specifically means stay away from any projects in there.
if( kiface->OnKifaceStart( m_program, m_ctl ) )
{
// Tell dso's wxDynamicLibrary destructor not to Unload() the program image.
ignore_unused( dso.Detach() );
try
{
startSuccess = kiface->OnKifaceStart( m_program, m_ctl );
}
catch (...)
{
// OnKiFaceStart may generate an exception
// Before we continue and ultimately unload our module to retry we need
// to process the exception before we delete the free the memory space the exception resides in
Pgm().HandleException( std::current_exception() );
}
if( startSuccess )
{
return m_kiface[aFaceId] = kiface;
}
else
{
// Usually means cancelled initial global library setup
// But it could have been an exception/failure
// Let the module go out of scope to unload
dso.Attach( dsoHandle );
return nullptr;
}
}
// In any of the failure cases above, dso.Unload() should be called here
@@ -414,6 +448,14 @@ KIWAY_PLAYER* KIWAY::Player( FRAME_T aFrameType, bool doCreate, wxTopLevelWindow
{
try
{
#ifdef KICAD_USE_SENTRY
wxString msg = wxString::Format( "Creating window type %d", aFrameType );
sentry_value_t crumb = sentry_value_new_breadcrumb( "navigation", msg.utf8_str() );
sentry_value_set_by_key( crumb, "category", sentry_value_new_string( "kiway.player" ) );
sentry_value_set_by_key( crumb, "level", sentry_value_new_string( "info" ) );
sentry_add_breadcrumb( crumb );
#endif
FACE_T face_type = KifaceType( aFrameType );
KIFACE* kiface = KiFACE( face_type );
@@ -429,18 +471,9 @@ KIWAY_PLAYER* KIWAY::Player( FRAME_T aFrameType, bool doCreate, wxTopLevelWindow
m_playerFrameId[aFrameType].store( frame->GetId() );
return frame;
}
catch( const IO_ERROR& ioe )
{
wxLogError( ioe.What() );
wxLogError( _( "Error loading editor." ) );
}
catch( const std::exception& e )
{
wxLogError( e.what() );
wxLogError( _( "Error loading editor." ) );
}
catch( ... )
{
Pgm().HandleException( std::current_exception() );
wxLogError( _( "Error loading editor." ) );
}
}
@@ -462,11 +495,19 @@ bool KIWAY::PlayerClose( FRAME_T aFrameType, bool doForce )
return false;
}
KIWAY_PLAYER* frame = GetPlayerFrame( aFrameType );
KIWAY_PLAYER* frame = GetPlayerFrame( aFrameType );
if( frame == nullptr ) // Already closed
return true;
#ifdef KICAD_USE_SENTRY
wxString msg = wxString::Format( "Closing window type %d", aFrameType );
sentry_value_t crumb = sentry_value_new_breadcrumb( "navigation", msg.utf8_str() );
sentry_value_set_by_key( crumb, "category", sentry_value_new_string( "kiway.playerclose" ) );
sentry_value_set_by_key( crumb, "level", sentry_value_new_string( "info" ) );
sentry_add_breadcrumb( crumb );
#endif
if( frame->NonUserClose( doForce ) )
{
m_playerFrameId[aFrameType] = wxID_NONE;
@@ -482,14 +523,18 @@ bool KIWAY::PlayersClose( bool doForce )
bool ret = true;
for( unsigned i=0; i < KIWAY_PLAYER_COUNT; ++i )
{
ret = ret && PlayerClose( FRAME_T( i ), doForce );
}
return ret;
}
void KIWAY::PlayerDidClose( FRAME_T aFrameType )
{
m_playerFrameId[aFrameType] = wxID_NONE;
}
void KIWAY::ExpressMail( FRAME_T aDestination, MAIL_T aCommand, std::string& aPayload,
wxWindow* aSource )
{
@@ -599,6 +644,13 @@ void KIWAY::CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged )
void KIWAY::ProjectChanged()
{
#ifdef KICAD_USE_SENTRY
sentry_value_t crumb = sentry_value_new_breadcrumb( "navigation", "Changing project" );
sentry_value_set_by_key( crumb, "category", sentry_value_new_string( "kiway.projectchanged" ) );
sentry_value_set_by_key( crumb, "level", sentry_value_new_string( "info" ) );
sentry_add_breadcrumb( crumb );
#endif
if( m_ctl & KFCTL_CPP_PROJECT_SUITE )
{
// A dynamic_cast could be better, but creates link issues
+8
View File
@@ -55,6 +55,12 @@ KIWAY_PLAYER::KIWAY_PLAYER( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType
}
// Don't use this one; it's only for wxFormBuilder, and it must be augmented with code to
// correct the m_ident and set the m_kiway early in derived constructor.
//
// Because of its inherent danger, it's also declared private and requires friend-class
// declarations for each usage.
//
KIWAY_PLAYER::KIWAY_PLAYER( wxWindow* aParent, wxWindowID aId, const wxString& aTitle,
const wxPoint& aPos, const wxSize& aSize, long aStyle,
const wxString& aWdoName ) :
@@ -169,6 +175,8 @@ bool KIWAY_PLAYER::ShowModal( wxString* aResult, wxWindow* aResultantFocusWindow
bool KIWAY_PLAYER::Destroy()
{
Kiway().PlayerDidClose( GetFrameType() );
return EDA_BASE_FRAME::Destroy();
}
+4 -6
View File
@@ -3,7 +3,7 @@
*lib_tree_model
* Copyright (C) 2017 Chris Pavlina <pavlina.chris@gmail.com>
* Copyright (C) 2014 Henner Zeller <h.zeller@acm.org>
* Copyright (C) 2014-2019 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2014-2023 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@@ -24,14 +24,12 @@
#include <algorithm>
#include <eda_pattern_match.h>
#include <lib_tree_item.h>
#include <utility>
#include <pgm_base.h>
#include <string_utils.h>
// Each node gets this lowest score initially, without any matches applied.
// Matches will then increase this score depending on match quality. This way,
// an empty search string will result in all components being displayed as they
// have the minimum score. However, in that case, we avoid expanding all the
// Each node gets this lowest score initially, without any matches applied. Matches will then
// increase this score. This way, an empty search string will result in all components being
// displayed as they have the minimum score. However, in that case, we avoid expanding all the
// nodes asd the result is very unspecific.
static const unsigned kLowestDefaultScore = 1;
+74 -82
View File
@@ -3,7 +3,7 @@
*
* Copyright (C) 2017 Chris Pavlina <pavlina.chris@gmail.com>
* Copyright (C) 2014 Henner Zeller <h.zeller@acm.org>
* Copyright (C) 2014-2022 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2014-2023 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@@ -213,17 +213,11 @@ void LIB_TREE_MODEL_ADAPTER::UpdateSearchString( const wxString& aSearch, bool a
Thaw();
}
LIB_TREE_NODE* bestMatch = ShowResults();
const LIB_TREE_NODE* firstMatch = ShowResults();
if( !bestMatch )
bestMatch = ShowPreselect();
if( !bestMatch )
bestMatch = ShowSingleLibrary();
if( bestMatch )
if( firstMatch )
{
wxDataViewItem item = wxDataViewItem( bestMatch );
wxDataViewItem item = ToItem( firstMatch );
m_widget->Select( item );
// Make sure the *parent* item is visible. The selected item is the
@@ -422,6 +416,12 @@ wxDataViewItem LIB_TREE_MODEL_ADAPTER::FindItem( const LIB_ID& aLibId )
}
wxDataViewItem LIB_TREE_MODEL_ADAPTER::GetCurrentDataViewItem()
{
return FindItem( m_preselect_lib_id );
}
unsigned int LIB_TREE_MODEL_ADAPTER::GetChildren( const wxDataViewItem& aItem,
wxDataViewItemArray& aChildren ) const
{
@@ -619,93 +619,85 @@ bool LIB_TREE_MODEL_ADAPTER::GetAttr( const wxDataViewItem& aItem,
}
void LIB_TREE_MODEL_ADAPTER::Find( LIB_TREE_NODE& aNode,
std::function<bool( const LIB_TREE_NODE* )> aFunc,
LIB_TREE_NODE** aHighScore )
void recursiveDescent( LIB_TREE_NODE& aNode, const std::function<bool( const LIB_TREE_NODE* )>& f )
{
for( std::unique_ptr<LIB_TREE_NODE>& node: aNode.m_Children )
{
if( aFunc( &*node ) )
{
if( !(*aHighScore) || node->m_Score > (*aHighScore)->m_Score )
(*aHighScore) = &*node;
}
if( !f( node.get() ) )
break;
Find( *node, aFunc, aHighScore );
recursiveDescent( *node, f );
}
}
LIB_TREE_NODE* LIB_TREE_MODEL_ADAPTER::ShowResults()
const LIB_TREE_NODE* LIB_TREE_MODEL_ADAPTER::ShowResults()
{
LIB_TREE_NODE* highScore = nullptr;
const LIB_TREE_NODE* firstMatch = nullptr;
Find( m_tree,
[]( LIB_TREE_NODE const* n )
{
// return leaf nodes with some level of matching
return n->m_Type == LIB_TREE_NODE::TYPE::LIBID && n->m_Score > 1;
},
&highScore );
if( highScore)
{
wxDataViewItem item = wxDataViewItem( highScore );
m_widget->ExpandAncestors( item );
}
return highScore;
}
LIB_TREE_NODE* LIB_TREE_MODEL_ADAPTER::ShowPreselect()
{
LIB_TREE_NODE* highScore = nullptr;
if( !m_preselect_lib_id.IsValid() )
return highScore;
Find( m_tree,
[&]( LIB_TREE_NODE const* n )
// Expand parents of leaf nodes with some level of matching
recursiveDescent( m_tree,
[&]( const LIB_TREE_NODE* n )
{
if( n->m_Type == LIB_TREE_NODE::LIBID && ( n->m_Children.empty() ||
!m_preselect_unit ) )
return m_preselect_lib_id == n->m_LibId;
else if( n->m_Type == LIB_TREE_NODE::UNIT && m_preselect_unit )
return m_preselect_lib_id == n->m_Parent->m_LibId &&
m_preselect_unit == n->m_Unit;
else
return false;
},
&highScore );
if( n->m_Type == LIB_TREE_NODE::TYPE::LIBID && n->m_Score > 1 )
{
if( !firstMatch )
firstMatch = n;
else if( n->m_Score > firstMatch->m_Score )
firstMatch = n;
if( highScore)
m_widget->ExpandAncestors( ToItem( n ) );
}
return true; // keep going to expand ancestors of all found items
} );
// If no matches, find and show the preselect node
if( !firstMatch && m_preselect_lib_id.IsValid() )
{
wxDataViewItem item = wxDataViewItem( highScore );
m_widget->ExpandAncestors( item );
recursiveDescent( m_tree,
[&]( const LIB_TREE_NODE* n )
{
if( n->m_Type == LIB_TREE_NODE::LIBID
&& ( n->m_Children.empty() || !m_preselect_unit )
&& m_preselect_lib_id == n->m_LibId )
{
firstMatch = n;
m_widget->ExpandAncestors( ToItem( n ) );
return false;
}
else if( n->m_Type == LIB_TREE_NODE::UNIT
&& ( m_preselect_unit && m_preselect_unit == n->m_Unit )
&& m_preselect_lib_id == n->m_Parent->m_LibId )
{
firstMatch = n;
m_widget->ExpandAncestors( ToItem( n ) );
return false;
}
return true;
} );
}
return highScore;
// If still no matches expand a single library if there is only one
if( !firstMatch )
{
recursiveDescent( m_tree,
[&]( const LIB_TREE_NODE* n )
{
if( n->m_Type == LIB_TREE_NODE::TYPE::LIBID
&& n->m_Parent->m_Parent->m_Children.size() == 1 )
{
firstMatch = n;
m_widget->ExpandAncestors( ToItem( n ) );
return false;
}
return true;
} );
}
return firstMatch;
}
LIB_TREE_NODE* LIB_TREE_MODEL_ADAPTER::ShowSingleLibrary()
{
LIB_TREE_NODE* highScore = nullptr;
Find( m_tree,
[]( LIB_TREE_NODE const* n )
{
return n->m_Type == LIB_TREE_NODE::TYPE::LIBID &&
n->m_Parent->m_Parent->m_Children.size() == 1;
},
&highScore );
if( highScore)
{
wxDataViewItem item = wxDataViewItem( highScore );
m_widget->ExpandAncestors( item );
}
return highScore;
}
+1 -1
View File
@@ -1220,7 +1220,7 @@ void UOP::Exec( CONTEXT* ctx )
result = arg1Value != 0.0 ? 0 : 1;
break;
default:
result = 0.0;
result = arg1Value != 0.0 ? 1 : 0;
break;
}
-96
View File
@@ -1,96 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2014-2015 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2014-2022 KiCad Developers, see AUTHORS.TXT for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <memory>
#include <build_version.h>
#include <lockfile.h>
#include <wx/filename.h>
#include <wx/snglinst.h>
std::unique_ptr<wxSingleInstanceChecker> LockFile( const wxString& aFileName )
{
// first make absolute and normalize, to avoid that different lock files
// for the same file can be created
wxFileName fn( aFileName );
fn.MakeAbsolute();
wxString lockFileName = fn.GetFullPath() + ".lock";
lockFileName.Replace( "/", "_" );
// We can have filenames coming from Windows, so also convert Windows separator
lockFileName.Replace( "\\", "_" );
auto p = std::make_unique<wxSingleInstanceChecker>( lockFileName, GetKicadLockFilePath() );
if( p->IsAnotherRunning() )
p = nullptr;
return p;
}
wxString GetKicadLockFilePath()
{
wxFileName lockpath;
lockpath.AssignDir( wxGetHomeDir() ); // Default wx behavior
#if defined( __WXMAC__ )
// In OSX use the standard per user cache directory
lockpath.AppendDir( "Library" );
lockpath.AppendDir( "Caches" );
lockpath.AppendDir( "kicad" );
#elif defined( __UNIX__ )
wxString envstr;
// Try first the standard XDG_RUNTIME_DIR, falling back to XDG_CACHE_HOME
if( wxGetEnv( "XDG_RUNTIME_DIR", &envstr ) && !envstr.IsEmpty() )
{
lockpath.AssignDir( envstr );
}
else if( wxGetEnv( "XDG_CACHE_HOME", &envstr ) && !envstr.IsEmpty() )
{
lockpath.AssignDir( envstr );
}
else
{
// If all fails, just use ~/.cache
lockpath.AppendDir( ".cache" );
}
lockpath.AppendDir( wxString::Format( "kicad_v%s", GetMajorMinorVersion() ) );
#endif
#if defined( __WXMAC__ ) || defined( __UNIX__ )
if( !lockpath.DirExists() )
{
// Lockfiles should be only readable by the user
lockpath.Mkdir( 0700, wxPATH_MKDIR_FULL );
}
#endif
return lockpath.GetPath();
}
+40 -2
View File
@@ -43,6 +43,7 @@
#include <wx/tooltip.h>
#include <advanced_config.h>
#include <cli/cli_names.h> // Needed for the pre wx 3.2 cli workaround
#include <common.h>
#include <config_params.h>
#include <confirm.h>
@@ -51,8 +52,9 @@
#include <eda_draw_frame.h>
#include <gestfich.h>
#include <id.h>
#include <kicad_curl/kicad_curl.h>
#include <kiplatform/policy.h>
#include <lockfile.h>
#include <macros.h>
#include <menus_helpers.h>
#include <paths.h>
#include <pgm_base.h>
@@ -150,6 +152,8 @@ PGM_BASE::~PGM_BASE()
void PGM_BASE::Destroy()
{
KICAD_CURL::Cleanup();
#ifdef KICAD_USE_SENTRY
sentry_close();
#endif
@@ -408,6 +412,8 @@ bool PGM_BASE::InitPgm( bool aHeadless, bool aSkipPyInit, bool aIsUnitTest )
// In particular, the user cache path is the most likely to be hit by startup code
PATHS::EnsureUserPathsExist();
KICAD_CURL::Init();
#ifdef KICAD_USE_SENTRY
sentryInit();
#endif
@@ -874,4 +880,36 @@ bool PGM_BASE::IsGUI()
bool run_gui = wxTheApp->GetClassName() != KICAD_CLI_APP_NAME;
return run_gui;
#endif
}
}
void PGM_BASE::HandleException( std::exception_ptr aPtr )
{
try
{
if( aPtr )
std::rethrow_exception( aPtr );
}
catch( const IO_ERROR& ioe )
{
wxLogError( ioe.What() );
}
catch( const std::exception& e )
{
#ifdef KICAD_USE_SENTRY
sentry_value_t exc = sentry_value_new_exception( "exception", e.what() );
sentry_value_set_stacktrace( exc, NULL, 0 );
sentry_value_t sentryEvent = sentry_value_new_event();
sentry_event_add_exception( sentryEvent, exc );
sentry_capture_event( sentryEvent );
#endif
wxLogError( wxT( "Unhandled exception class: %s what: %s" ),
FROM_UTF8( typeid( e ).name() ), FROM_UTF8( e.what() ) );
}
catch( ... )
{
wxLogError( wxT( "Unhandled exception of unknown type" ) );
}
}
+5 -4
View File
@@ -513,10 +513,11 @@ void PDF_PLOTTER::PlotImage( const wxImage& aImage, const VECTOR2I& aPos, double
if( alpha < 0xFF )
{
float a = 1.0 - ( (float) alpha / 255.0 );
r = ( int )( r + ( a * 0xFF ) ) & 0xFF;
g = ( int )( g + ( a * 0xFF ) ) & 0xFF;
b = ( int )( b + ( a * 0xFF ) ) & 0xFF;
float d = alpha / 255.0;
float a = 1.0 - d;
r = std::min( KiROUND( r * d + ( a * 0xFF ) ), 0xFF );
g = std::min( KiROUND( g * d + ( a * 0xFF ) ), 0xFF );
b = std::min( KiROUND( b * d + ( a * 0xFF ) ), 0xFF );
}
}
+4 -4
View File
@@ -139,10 +139,10 @@ void PlotDrawingSheet( PLOTTER* plotter, const PROJECT* aProject, const TITLE_BL
int penWidth = std::max( text->GetEffectiveTextPenWidth(), defaultPenWidth );
plotter->Text( text->GetTextPos(), color, text->GetShownText(), text->GetTextAngle(),
text->GetTextSize(), text->GetHorizJustify(), text->GetVertJustify(),
penWidth, text->IsItalic(), text->IsBold(), text->IsMultilineAllowed(),
font );
plotter->Text( text->GetTextPos(), color, text->GetShownText( true ),
text->GetTextAngle(), text->GetTextSize(), text->GetHorizJustify(),
text->GetVertJustify(), penWidth, text->IsItalic(), text->IsBold(),
text->IsMultilineAllowed(), font );
}
break;
+26 -19
View File
@@ -49,7 +49,7 @@ wxString escapeName( const wxString& aNetName )
wxString interpretText( const wxString& aText )
{
wxString token = aText.Upper();
wxString token = aText;
if( substituteVariable( &token ) )
return token;
@@ -116,25 +116,32 @@ wxString interpretText( const wxString& aText )
bool substituteVariable( wxString* aText )
{
if ( *aText == wxT( ">NAME" ) ) *aText = wxT( "${REFERENCE}" );
else if( *aText == wxT( ">VALUE" ) ) *aText = wxT( "${VALUE}" );
else if( *aText == wxT( ">PART" ) ) *aText = wxT( "${REFERENCE}" );
else if( *aText == wxT( ">GATE" ) ) *aText = wxT( "${UNIT}" );
else if( *aText == wxT( ">MODULE" ) ) *aText = wxT( "${FOOTPRINT_NAME}" );
else if( *aText == wxT( ">SHEETNR" ) ) *aText = wxT( "${#}" );
else if( *aText == wxT( ">SHEETS" ) ) *aText = wxT( "${##}" );
else if( *aText == wxT( ">SHEET" ) ) *aText = wxT( "${#}/${##}" );
else if( *aText == wxT( ">SHEETNR_TOTAL" ) ) *aText = wxT( "${#}" );
else if( *aText == wxT( ">SHEETS_TOTAL" ) ) *aText = wxT( "${##}" );
else if( *aText == wxT( ">SHEET_TOTAL" ) ) *aText = wxT( "${#}/${##}" );
else if( *aText == wxT( ">SHEET_HEADLINE" ) ) *aText = wxT( "${SHEETNAME}" );
else if( *aText == wxT( ">ASSEMBLY_VARIANT" ) ) *aText = wxT( "${ASSEMBLY_VARIANT}" );
else if( *aText == wxT( ">DRAWING_NAME" ) ) *aText = wxT( "${PROJECTNAME}" );
else if( *aText == wxT( ">LAST_DATE_TIME" ) ) *aText = wxT( "${CURRENT_DATE}" );
else if( *aText == wxT( ">PLOT_DATE_TIME" ) ) *aText = wxT( "${CURRENT_DATE}" );
else return false;
if( aText->StartsWith( '>' ) && aText->AfterFirst( ' ' ).IsEmpty() )
{
wxString token = aText->Upper();
return true;
if ( token == wxT( ">NAME" ) ) *aText = wxT( "${REFERENCE}" );
else if( token == wxT( ">VALUE" ) ) *aText = wxT( "${VALUE}" );
else if( token == wxT( ">PART" ) ) *aText = wxT( "${REFERENCE}" );
else if( token == wxT( ">GATE" ) ) *aText = wxT( "${UNIT}" );
else if( token == wxT( ">MODULE" ) ) *aText = wxT( "${FOOTPRINT_NAME}" );
else if( token == wxT( ">SHEETNR" ) ) *aText = wxT( "${#}" );
else if( token == wxT( ">SHEETS" ) ) *aText = wxT( "${##}" );
else if( token == wxT( ">SHEET" ) ) *aText = wxT( "${#}/${##}" );
else if( token == wxT( ">SHEETNR_TOTAL" ) ) *aText = wxT( "${#}" );
else if( token == wxT( ">SHEETS_TOTAL" ) ) *aText = wxT( "${##}" );
else if( token == wxT( ">SHEET_TOTAL" ) ) *aText = wxT( "${#}/${##}" );
else if( token == wxT( ">SHEET_HEADLINE" ) ) *aText = wxT( "${SHEETNAME}" );
else if( token == wxT( ">ASSEMBLY_VARIANT" ) ) *aText = wxT( "${ASSEMBLY_VARIANT}" );
else if( token == wxT( ">DRAWING_NAME" ) ) *aText = wxT( "${PROJECTNAME}" );
else if( token == wxT( ">LAST_DATE_TIME" ) ) *aText = wxT( "${CURRENT_DATE}" );
else if( token == wxT( ">PLOT_DATE_TIME" ) ) *aText = wxT( "${CURRENT_DATE}" );
else *aText = wxString::Format( wxS( "${%s}" ), aText->Mid( 1 ).Trim() );
return true;
}
return false;
}
+2 -5
View File
@@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2020 CERN
* Copyright (C) 2021-2022 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2021-2023 KiCad Developers, see AUTHORS.txt for contributors.
* @author Jon Evans <jon@craftyjon.com>
*
* This program is free software: you can redistribute it and/or modify it
@@ -393,10 +393,7 @@ std::shared_ptr<NETCLASS> NET_SETTINGS::GetEffectiveNetClass( const wxString& aN
for( const auto& [ matcher, netclassName ] : m_NetClassPatternAssignments )
{
int matches;
int offset;
if( matcher->Find( aNetName, matches, offset ) && offset == 0 )
if( matcher->StartsWith( aNetName ) )
return getNetclass( netclassName );
}
@@ -210,6 +210,8 @@ PROJECT_LOCAL_SETTINGS::PROJECT_LOCAL_SETTINGS( PROJECT* aProject, const wxStrin
return;
}
m_files.clear();
for( const nlohmann::json& file : aVal )
{
PROJECT_FILE_STATE fileState;
+5
View File
@@ -73,9 +73,14 @@ wxPGWindowList PG_UNIT_EDITOR::CreateControls( wxPropertyGrid* aPropGrid, wxPGPr
m_unitBinder->SetUnits( m_frame->GetUserUnits() );
if( PGPROPERTY_DISTANCE* prop = dynamic_cast<PGPROPERTY_DISTANCE*>( aProperty ) )
{
m_unitBinder->SetCoordType( prop->CoordType() );
}
else if( dynamic_cast<PGPROPERTY_ANGLE*>( aProperty ) != nullptr )
{
m_unitBinder->SetCoordType( ORIGIN_TRANSFORMS::NOT_A_COORD );
m_unitBinder->SetUnits( EDA_UNITS::DEGREES );
}
UpdateControl( aProperty, win );
+24 -34
View File
@@ -258,8 +258,8 @@ void RC_TREE_MODEL::rebuildModel( std::shared_ptr<RC_ITEMS_PROVIDER> aProvider,
// The fastest method to update wxDataViewCtrl is to rebuild from
// scratch by calling Cleared(). Linux requires to reassociate model to
// display data, but Windows will create multiple associations.
// On MacOS, this crashes KiCad. See https://gitlab.com/kicad/code/kicad/issues/3666
// and https://gitlab.com/kicad/code/kicad/issues/3653
// On MacOS, this crashes KiCad. See https://gitlab.com/kicad/code/kicad/-/issues/3666
// and https://gitlab.com/kicad/code/kicad/-/issues/3653
m_view->AssociateModel( this );
#endif
@@ -333,73 +333,63 @@ void RC_TREE_MODEL::GetValue( wxVariant& aVariant,
{
const RC_TREE_NODE* node = ToNode( aItem );
const std::shared_ptr<RC_ITEM> rcItem = node->m_RcItem;
MARKER_BASE* marker = rcItem->GetParent();
EDA_ITEM* item = nullptr;
wxString msg;
switch( node->m_Type )
{
case RC_TREE_NODE::MARKER:
{
wxString prefix;
if( rcItem->GetParent() )
if( marker )
{
SEVERITY severity = rcItem->GetParent()->GetSeverity();
SEVERITY severity = marker->GetSeverity();
if( severity == RPT_SEVERITY_EXCLUSION )
{
if( m_editFrame->GetSeverity( rcItem->GetErrorCode() ) == RPT_SEVERITY_WARNING )
prefix = _( "Excluded warning: " );
msg = _( "Excluded warning: " );
else
prefix = _( "Excluded error: " );
msg = _( "Excluded error: " );
}
else if( severity == RPT_SEVERITY_WARNING )
{
prefix = _( "Warning: " );
msg = _( "Warning: " );
}
else
{
prefix = _( "Error: " );
msg = _( "Error: " );
}
}
aVariant = prefix + rcItem->GetErrorMessage();
}
msg += rcItem->GetErrorMessage();
break;
case RC_TREE_NODE::MAIN_ITEM:
if( rcItem->GetParent() && rcItem->GetParent()->GetMarkerType() == MARKER_BASE::MARKER_DRAWING_SHEET )
{
aVariant = _( "Drawing Sheet" );
break;
}
if( marker && marker->GetMarkerType() == MARKER_BASE::MARKER_DRAWING_SHEET )
msg = _( "Drawing Sheet" );
else
{
EDA_ITEM* item = m_editFrame->GetItem( rcItem->GetMainItemID() );
aVariant = item->GetItemDescription( m_editFrame );
}
item = m_editFrame->GetItem( rcItem->GetMainItemID() );
break;
case RC_TREE_NODE::AUX_ITEM:
{
EDA_ITEM* item = m_editFrame->GetItem( rcItem->GetAuxItemID() );
aVariant = item->GetItemDescription( m_editFrame );
}
item = m_editFrame->GetItem( rcItem->GetAuxItemID() );
break;
case RC_TREE_NODE::AUX_ITEM2:
{
EDA_ITEM* item = m_editFrame->GetItem( rcItem->GetAuxItem2ID() );
aVariant = item->GetItemDescription( m_editFrame );
}
item = m_editFrame->GetItem( rcItem->GetAuxItem2ID() );
break;
case RC_TREE_NODE::AUX_ITEM3:
{
EDA_ITEM* item = m_editFrame->GetItem( rcItem->GetAuxItem3ID() );
aVariant = item->GetItemDescription( m_editFrame );
}
item = m_editFrame->GetItem( rcItem->GetAuxItem3ID() );
break;
}
if( item )
msg += item->GetItemDescription( m_editFrame );
msg.Replace( wxS( "\n" ), wxS( " " ) );
aVariant = msg;
}
+44 -2
View File
@@ -27,6 +27,7 @@
#include <config.h> // HAVE_FGETC_NOLOCK
#include <ignore.h>
#include <kiplatform/io.h>
#include <richio.h>
#include <errno.h>
@@ -38,7 +39,7 @@
#if !defined( HAVE_FGETC_NOLOCK )
#ifdef _MSC_VER
//getc is not a macro on windows and adds a tiny overhead for the indirection to eventually calling fgetc
#define getc_unlocked fgetc
#define getc_unlocked _fgetc_nolock
#else
#define getc_unlocked getc
#endif
@@ -106,6 +107,47 @@ std::string StrPrintf( const char* format, ... )
}
wxString SafeReadFile( const wxString& aFilePath, const wxString& aReadType )
{
auto FROM_UTF8_WINE =
[]( const char* cstring )
{
wxString line = wxString::FromUTF8( cstring );
if( line.IsEmpty() ) // happens when cstring is not a valid UTF8 sequence
line = wxConvCurrent->cMB2WC( cstring ); // try to use locale conversion
// We have trouble here *probably* because Wine-hosted LTSpice writes out MSW
// encoded text on a macOS, where it isn't expected. In any case, wxWidgets'
// wxSafeConvert() appears to get around it.
if( line.IsEmpty() )
line = wxSafeConvertMB2WX( cstring );
// I'm not sure what the source of this style of line-endings is, but it can be
// found in some Fairchild Semiconductor SPICE files.
line.Replace( wxS( "\r\r\n" ), wxS( "\n" ) );
return line;
};
// Open file
FILE* fp = wxFopen( aFilePath, aReadType );
if( !fp )
THROW_IO_ERROR( wxString::Format( _( "Cannot open file '%s'." ), aFilePath ) );
FILE_LINE_READER fileReader( fp, aFilePath );
wxString contents;
while( fileReader.ReadLine() )
contents += FROM_UTF8_WINE( fileReader.Line() );
return contents;
}
//-----<LINE_READER>------------------------------------------------------
LINE_READER::LINE_READER( unsigned aMaxLineLength ) :
@@ -168,7 +210,7 @@ FILE_LINE_READER::FILE_LINE_READER( const wxString& aFileName, unsigned aStartin
unsigned aMaxLineLength ):
LINE_READER( aMaxLineLength ), m_iOwn( true )
{
m_fp = wxFopen( aFileName, wxT( "rt" ) );
m_fp = KIPLATFORM::IO::SeqFOpen( aFileName, wxT( "rt" ) );
if( !m_fp )
{
+9 -1
View File
@@ -162,7 +162,8 @@ void SCINTILLA_TRICKS::onCharHook( wxKeyEvent& aEvent )
if( !isalpha( aEvent.GetKeyCode() ) )
m_suppressAutocomplete = false;
if( aEvent.GetKeyCode() == WXK_RETURN && ( m_singleLine || aEvent.ShiftDown() ) )
if( ( aEvent.GetKeyCode() == WXK_RETURN || aEvent.GetKeyCode() == WXK_NUMPAD_ENTER )
&& ( m_singleLine || aEvent.ShiftDown() ) )
{
m_returnCallback();
}
@@ -242,6 +243,13 @@ void SCINTILLA_TRICKS::onCharHook( wxKeyEvent& aEvent )
}
else if( aEvent.GetKeyCode() == WXK_BACK )
{
if( aEvent.GetModifiers() == wxMOD_CONTROL )
#ifdef __WXMAC__
m_te->HomeExtend();
else if( aEvent.GetModifiers() == wxMOD_ALT )
#endif
m_te->WordLeftExtend();
m_te->DeleteBack();
}
else if( aEvent.GetKeyCode() == WXK_DELETE )
+13 -4
View File
@@ -109,8 +109,17 @@ void SETTINGS_MANAGER::Load()
// TODO(JE) We should check for dirty settings here and write them if so, because
// Load() could be called late in the application lifecycle
for( auto&& settings : m_settings )
settings->LoadFromFile( GetPathForSettingsFile( settings.get() ) );
std::vector<JSON_SETTINGS*> toLoad;
// Cache a copy of raw pointers; m_settings may be modified during the load loop
std::transform( m_settings.begin(), m_settings.end(), std::back_inserter( toLoad ),
[]( std::unique_ptr<JSON_SETTINGS>& aSettings )
{
return aSettings.get();
} );
for( JSON_SETTINGS* settings : toLoad )
settings->LoadFromFile( GetPathForSettingsFile( settings ) );
}
@@ -883,7 +892,7 @@ bool SETTINGS_MANAGER::LoadProject( const wxString& aFullPath, bool aSetActive )
return true;
bool readOnly = false;
std::unique_ptr<wxSingleInstanceChecker> lockFile = ::LockFile( fullPath );
LOCKFILE lockFile( fullPath );
if( !lockFile )
{
@@ -920,7 +929,7 @@ bool SETTINGS_MANAGER::LoadProject( const wxString& aFullPath, bool aSetActive )
project->SetReadOnly( readOnly || project->GetProjectFile().IsReadOnly() );
if( lockFile )
m_project_lock.reset( lockFile.release() );
m_project_lock.reset( new LOCKFILE( std::move( lockFile ) ) );
}
m_projects_list.push_back( std::move( project ) );
+11 -33
View File
@@ -46,11 +46,15 @@
#include <kiway_player.h>
#include <macros.h>
#include <confirm.h>
#include <settings/kicad_settings.h>
#include <settings/settings_manager.h>
#include <kiplatform/app.h>
#include <kiplatform/environment.h>
#ifdef KICAD_USE_SENTRY
#include <sentry.h>
#endif
// Only a single KIWAY is supported in this single_top top level component,
// which is dedicated to loading only a single DSO.
@@ -158,18 +162,9 @@ struct APP_SINGLE_TOP : public wxApp
{
return program.OnPgmInit();
}
catch( const std::exception& e )
catch( ... )
{
wxLogError( wxT( "Unhandled exception class: %s what: %s" ),
FROM_UTF8( typeid( e ).name() ), FROM_UTF8( e.what() ) );
}
catch( const IO_ERROR& ioe )
{
wxLogError( ioe.What() );
}
catch(...)
{
wxLogError( wxT( "Unhandled exception of unknown type" ) );
Pgm().HandleException( std::current_exception() );
}
program.OnPgmExit();
@@ -191,18 +186,9 @@ struct APP_SINGLE_TOP : public wxApp
{
ret = wxApp::OnRun();
}
catch( const std::exception& e )
{
wxLogError( wxT( "Unhandled exception class: %s what: %s" ),
FROM_UTF8( typeid( e ).name() ), FROM_UTF8( e.what() ) );
}
catch( const IO_ERROR& ioe )
{
wxLogError( ioe.What() );
}
catch(...)
{
wxLogError( wxT( "Unhandled exception of unknown type" ) );
Pgm().HandleException( std::current_exception() );
}
return ret;
@@ -253,19 +239,9 @@ struct APP_SINGLE_TOP : public wxApp
{
throw;
}
catch( const std::exception& e )
catch( ... )
{
wxLogError( "Unhandled exception class: %s what: %s",
FROM_UTF8( typeid(e).name() ),
FROM_UTF8( e.what() ) );
}
catch( const IO_ERROR& ioe )
{
wxLogError( ioe.What() );
}
catch(...)
{
wxLogError( "Unhandled exception of unknown type" );
Pgm().HandleException( std::current_exception() );
}
return false; // continue on. Return false to abort program
@@ -340,6 +316,8 @@ bool PGM_SINGLE_TOP::OnPgmInit()
// Tell the settings manager about the current Kiway
GetSettingsManager().SetKiway( &Kiway );
GetSettingsManager().RegisterSettings( new KICAD_SETTINGS );
// Use KIWAY to create a top window, which registers its existence also.
// "TOP_FRAME" is a macro that is passed on compiler command line from CMake,
// and is one of the types in FRAME_T.
+28 -19
View File
@@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004-2022 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2004-2023 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -159,9 +159,12 @@ wxString EscapeString( const wxString& aSource, ESCAPE_CONTEXT aContext )
else
converted += c;
}
else if( aContext == CTX_LIBID )
else if( aContext == CTX_LIBID || aContext == CTX_LEGACY_LIBID )
{
if( c == '\\' )
// We no longer escape '/' in LIB_IDs, but we used to
if( c == '/' && aContext == CTX_LEGACY_LIBID )
converted += wxT( "{slash}" );
else if( c == '\\' )
converted += wxT( "{backslash}" );
else if( c == '<' )
converted += wxT( "{lt}" );
@@ -277,42 +280,49 @@ wxString UnescapeString( const wxString& aSource )
wxString newbuf;
newbuf.reserve( sourceLen );
wxUniChar prev = 0;
wxUniChar ch = 0;
for( size_t i = 0; i < sourceLen; ++i )
{
wxUniChar ch = aSource[i];
prev = ch;
ch = aSource[i];
if( ( ch == '$' || ch == '~' || ch == '^' || ch == '_' )
&& i + 1 < sourceLen && aSource[i+1] == '{' )
{
for( ; i < sourceLen; ++i )
{
ch = aSource[i];
newbuf += ch;
if( ch == '}' )
break;
}
}
else if( ch == '{' )
if( ch == '{' )
{
wxString token;
int depth = 1;
bool terminated = false;
for( i = i + 1; i < sourceLen; ++i )
{
ch = aSource[i];
if( ch == '{' )
depth++;
else if( ch == '}' )
depth--;
if( depth <= 0 )
{
terminated = true;
break;
}
else
{
token.append( ch );
}
}
if( token == wxT( "dblquote" ) ) newbuf.append( wxT( "\"" ) );
if( !terminated )
{
newbuf.append( wxT( "{" ) + UnescapeString( token ) );
}
else if( prev == '$' || prev == '~' || prev == '^' || prev == '_' )
{
newbuf.append( wxT( "{" ) + UnescapeString( token ) + wxT( "}" ) );
}
else if( token == wxT( "dblquote" ) ) newbuf.append( wxT( "\"" ) );
else if( token == wxT( "quote" ) ) newbuf.append( wxT( "'" ) );
else if( token == wxT( "lt" ) ) newbuf.append( wxT( "<" ) );
else if( token == wxT( "gt" ) ) newbuf.append( wxT( ">" ) );
@@ -326,7 +336,6 @@ wxString UnescapeString( const wxString& aSource )
else if( token == wxT( "tab" ) ) newbuf.append( wxT( "\t" ) );
else if( token == wxT( "return" ) ) newbuf.append( wxT( "\n" ) );
else if( token == wxT( "brace" ) ) newbuf.append( wxT( "{" ) );
else if( token.IsEmpty() ) newbuf.append( wxT( "{" ) );
else
{
newbuf.append( wxT( "{" ) + UnescapeString( token ) + wxT( "}" ) );
+6 -2
View File
@@ -129,7 +129,10 @@ void TEMPLATES::Format( OUTPUTFORMATTER* out, int nestLevel, bool aGlobal ) cons
const TEMPLATE_FIELDNAMES& source = aGlobal ? m_globals : m_project;
for( const TEMPLATE_FIELDNAME& temp : source )
temp.Format( out, nestLevel+1 );
{
if( !temp.m_Name.IsEmpty() )
temp.Format( out, nestLevel+1 );
}
out->Print( 0, ")\n" );
}
@@ -162,7 +165,8 @@ void TEMPLATES::parse( TEMPLATE_FIELDNAMES_LEXER* in, bool aGlobal )
field.Parse( in );
// add the field
AddTemplateFieldName( field, aGlobal );
if( !field.m_Name.IsEmpty() )
AddTemplateFieldName( field, aGlobal );
}
break;
+4
View File
@@ -41,6 +41,10 @@ void TEXTENTRY_TRICKS::OnCharHook( wxTextEntry* aTextEntry, wxKeyEvent& aEvent )
{
aTextEntry->Paste();
}
else if( aEvent.GetModifiers() == wxMOD_CONTROL && aEvent.GetKeyCode() == 'A' )
{
aTextEntry->SelectAll();
}
else if( aEvent.GetKeyCode() == WXK_BACK )
{
long start, end;
+4 -2
View File
@@ -50,7 +50,7 @@
/// URL to launch a new issue with pre-populated description
wxString COMMON_CONTROL::m_bugReportUrl =
wxS( "https://gitlab.com/kicad/code/kicad/issues/new?issuable_template=bare&issue[description]=%s" );
wxS( "https://gitlab.com/kicad/code/kicad/-/issues/new?issuable_template=bare&issue[description]=%s" );
/// Issue template to use for reporting bugs (this should not be translated)
@@ -130,7 +130,9 @@ int COMMON_CONTROL::ShowLibraryTable( const TOOL_EVENT& aEvent )
try // Pcb frame was not available, try to start it
{
KIFACE* kiface = m_frame->Kiway().KiFACE( KIWAY::FACE_PCB );
kiface->CreateKiWindow( m_frame, DIALOG_PCB_LIBRARY_TABLE, &m_frame->Kiway() );
if( kiface )
kiface->CreateKiWindow( m_frame, DIALOG_PCB_LIBRARY_TABLE, &m_frame->Kiway() );
}
catch( ... )
{
+40 -43
View File
@@ -240,16 +240,14 @@ private:
void VIEW::OnDestroy( VIEW_ITEM* aItem )
{
VIEW_ITEM_DATA* data = aItem->viewPrivData();
if( aItem->m_viewPrivData )
{
if( aItem->m_viewPrivData->m_view )
aItem->m_viewPrivData->m_view->VIEW::Remove( aItem );
if( !data )
return;
if( data->m_view )
data->m_view->VIEW::Remove( aItem );
delete data;
aItem->ClearViewPrivData();
delete aItem->m_viewPrivData;
aItem->m_viewPrivData = nullptr;
}
}
@@ -323,6 +321,10 @@ void VIEW::Add( VIEW_ITEM* aItem, int aDrawPriority )
if( !aItem->m_viewPrivData )
aItem->m_viewPrivData = new VIEW_ITEM_DATA;
wxASSERT_MSG( aItem->m_viewPrivData->m_view == nullptr
|| aItem->m_viewPrivData->m_view == this,
wxS( "Already in a different view!" ) );
aItem->m_viewPrivData->m_view = this;
aItem->m_viewPrivData->m_drawPriority = aDrawPriority;
@@ -334,7 +336,7 @@ void VIEW::Add( VIEW_ITEM* aItem, int aDrawPriority )
for( int i = 0; i < layers_count; ++i )
{
wxCHECK2_MSG( layers[i] >= 0 && static_cast<unsigned>( layers[i] ) < m_layers.size(),
continue, wxS( "Invalid layer" ) );
continue, wxS( "Invalid layer" ) );
VIEW_LAYER& l = m_layers[layers[i]];
l.items->Insert( aItem );
@@ -348,41 +350,36 @@ void VIEW::Add( VIEW_ITEM* aItem, int aDrawPriority )
void VIEW::Remove( VIEW_ITEM* aItem )
{
if( !aItem )
return;
auto viewData = aItem->viewPrivData();
if( !viewData )
return;
wxCHECK( viewData->m_view == this, /*void*/ );
auto item = std::find( m_allItems->begin(), m_allItems->end(), aItem );
if( item != m_allItems->end() )
if( aItem && aItem->m_viewPrivData )
{
m_allItems->erase( item );
viewData->clearUpdateFlags();
wxCHECK( aItem->m_viewPrivData->m_view == this, /*void*/ );
auto item = std::find( m_allItems->begin(), m_allItems->end(), aItem );
if( item != m_allItems->end() )
{
m_allItems->erase( item );
aItem->m_viewPrivData->clearUpdateFlags();
}
int layers[VIEW::VIEW_MAX_LAYERS], layers_count;
aItem->m_viewPrivData->getLayers( layers, layers_count );
for( int i = 0; i < layers_count; ++i )
{
VIEW_LAYER& l = m_layers[layers[i]];
l.items->Remove( aItem );
MarkTargetDirty( l.target );
// Clear the GAL cache
int prevGroup = aItem->m_viewPrivData->getGroup( layers[i] );
if( prevGroup >= 0 )
m_gal->DeleteGroup( prevGroup );
}
aItem->m_viewPrivData->deleteGroups();
aItem->m_viewPrivData->m_view = nullptr;
}
int layers[VIEW::VIEW_MAX_LAYERS], layers_count;
viewData->getLayers( layers, layers_count );
for( int i = 0; i < layers_count; ++i )
{
VIEW_LAYER& l = m_layers[layers[i]];
l.items->Remove( aItem );
MarkTargetDirty( l.target );
// Clear the GAL cache
int prevGroup = viewData->getGroup( layers[i] );
if( prevGroup >= 0 )
m_gal->DeleteGroup( prevGroup );
}
viewData->deleteGroups();
viewData->m_view = nullptr;
}
+10 -3
View File
@@ -23,6 +23,7 @@
#include <project.h>
#include <widgets/footprint_choice.h>
#include <widgets/footprint_select_widget.h>
#include <widgets/wx_progress_reporters.h>
#include <progress_reporter.h>
#include <footprint_info_impl.h>
#include <wx/wupdlock.h>
@@ -38,7 +39,8 @@ FOOTPRINT_SELECT_WIDGET::FOOTPRINT_SELECT_WIDGET( EDA_DRAW_FRAME* aFrame, wxWind
wxPanel( aParent ),
m_update( aUpdate ),
m_max_items( aMaxItems ),
m_fp_list( aFpList )
m_fp_list( aFpList ),
m_frame( aFrame )
{
m_zero_filter = true;
m_sizer = new wxBoxSizer( wxVERTICAL );
@@ -63,8 +65,13 @@ void FOOTPRINT_SELECT_WIDGET::Load( KIWAY& aKiway, PROJECT& aProject )
{
// If the fp-info-cache is empty (or, more likely, hasn't been created in a new
// project yet), load footprints the hard way.
FP_LIB_TABLE* fpTable = aProject.PcbFootprintLibs( aKiway );
static_cast<FOOTPRINT_LIST_IMPL*>( m_fp_list )->ReadFootprintFiles( fpTable );
FP_LIB_TABLE* fpTable = aProject.PcbFootprintLibs( aKiway );
WX_PROGRESS_REPORTER* progressReporter =
new WX_PROGRESS_REPORTER( m_frame, _( "Loading Footprint Libraries" ), 3 );
static_cast<FOOTPRINT_LIST_IMPL*>( m_fp_list )
->ReadFootprintFiles( fpTable, nullptr, progressReporter );
delete progressReporter;
}
m_fp_filter.SetList( *m_fp_list );
+6 -1
View File
@@ -491,7 +491,11 @@ void LIB_TREE::onDebounceTimer( wxTimerEvent& aEvent )
void LIB_TREE::onQueryCharHook( wxKeyEvent& aKeyStroke )
{
const wxDataViewItem sel = m_tree_ctrl->GetSelection();
wxDataViewItem sel = m_tree_ctrl->GetSelection();
if( !sel.IsOk() )
sel = m_adapter->GetCurrentDataViewItem();
LIB_TREE_NODE::TYPE type = sel.IsOk() ? m_adapter->GetTypeFor( sel ) : LIB_TREE_NODE::INVALID;
switch( aKeyStroke.GetKeyCode() )
@@ -523,6 +527,7 @@ void LIB_TREE::onQueryCharHook( wxKeyEvent& aKeyStroke )
break;
case WXK_RETURN:
case WXK_NUMPAD_ENTER:
updateRecentSearchMenu();
if( GetSelectedLibId().IsValid() )

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